I've created a systemd service unit file, and since systemd version 240+, we can just set the STDOUT + STDERR outputs to go directly into files, like this:
StandardOutput=append:/tmp/my-service.log
StandardError=append:/tmp/my-service.log
Is there a way for me to add in the current timestamp of when the service was started into these filenames?
e.g. instead of /tmp/my-service.log, each time the service starts, it's something like: /tmp/my-service.2022-07-07_114035.log
If it was similar to a shell script, I could do something like:
StandardOutput=append:/tmp/my-service.$(date +%Y-%m-%d_%H%M%S).log
StandardError=append:/tmp/my-service.$(date +%Y-%m-%d_%H%M%S).log
...but that doesn't work in systemd config files.
/bin/date?StandardOutput=andStandardError=fields?$()in the first place.