How to redirect output of systemd service to a file

I think there’s a more elegant way to solve the problem: send the stdout/stderr to syslog with an identifier and instruct your syslog manager to split its output by program name. Use the following properties in your systemd service unit file: StandardOutput=syslog StandardError=syslog SyslogIdentifier=<your program identifier> # without any quote Then, assuming your distribution is … Read more