So, I'm using systemd to send the logs to rsyslog, and I want to write the logs to /var/log/app.log.

Since it is a Java app with its own log format, I don't want to have timestamps or anything on it, just the message itself.

What I have so far is this:

Description=My App

ExecStart=/usr/bin/java -jar /opt/app.jar


And then I have thet /etc/rsyslog.d/myapp.conf file:

template(name="clean" type="string" string="%msg:2:$:drop-last-lf%\n")

if $programname == 'myapp' then action(type="omfile" file="/var/log/app.log" template="clean")
& stop

If I understand this correctly, if the program name is myapp, it should use the clean template and save the logs to /var/log/app.log and then stop.

That works, except that it also sends the logs to /var/log/syslog.

How can I prevent it to save these logs to syslog too?

1 Answer 1


The issue was that the default config file was called 50-defaults.conf, so it was processed first...

That means that logs were being sent to /var/log/syslog as per defaults config, and then it goes through my config file, which does the stop, but it didn't matter because there was nothing after it.

Renaming it to 10-myapp.conf fixes the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.