Skip to content
Redirect program logs to a separate file with rsyslog

Redirect program logs to a separate file with rsyslog

Nothing complicated – create a new configuration file and restart the service:

cat > /etc/rsyslog.d/program_name.conf <<'EOF'
if $programname == 'program_name' then /var/log/program_name.log
& ~
EOF

service rsyslog restart

& ~ means “stop processing this message”, so it isn’t duplicated in the general syslog file.

Last updated on