Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 533 Bytes

systemd.md

File metadata and controls

27 lines (19 loc) · 533 Bytes

systemd

Logging to Dedicated File

For each service, create a rsyslog configuration in /etc/rsyslog.d/FILE.conf and give it 644 permissions:

if $programname == 'PROGRAM_ID' then /path/to/log/file.log
& stop

For multiple services starting with same name:

if $programname startswith 'PROGRAM_ID' then /path/to/log/file.log
& stop

In the service file itself, add:

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=PROGRAM_ID

Finally, run sudo systemctl restart rsyslog.