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:
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:
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.