My computer runs serveral java processes as systemd services.The systemd logs get accumulated in the syslog eventually leading to low disk space . How to re-direct the logs started by systemd services towards /dev/null so that it does not accumulate in syslog.The machine is constantly running out of disk space due to this issue.However , I need to be able to use journalctl to view the systemd service logs. The possible solutions I found were :
1.To modify configurations in /etc/systemd/journald.conf by setting
'ForwardToSyslog=no'
2.Adding StandardOutput=null within the systemd service file itself
However the first solution completely stopped all the logs sent to syslog and solution 2 did not work.I wish to stop forwarding only the log messages from systemd services.
BarbosSergos :
The second option with StandardOutput=null should work. I think what you need is to redirect also STDERR to /dev/null, by adding StandardError=null.\nSummarize - in your *.service file should be two lines:\n\n[Service]\nStandardOutput=null\nStandardError=null\n\n\nRefer SYSTEMD.EXEC(5) man page for more details. ",
2019-04-11T08:04:22