So, I'm using
systemd to send the logs to
rsyslog, and I want to write the logs to
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:
[Unit] Description=My App After=network-online.target Wants=network-online.target [Service] Type=simple StandardOutput=syslog StandardError=syslog SyslogIdentifier=myapp ExecStart=/usr/bin/java -jar /opt/app.jar Restart=on-failure [Install] WantedBy=multi-user.target
And then I have thet
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
How can I prevent it to save these logs to syslog too?