Processes started with systemd are logging to /var/log/syslog and /var/log/daemon.log

8.8k views Asked by At

I'm running a couple of python scripts on a Beaglebone Black, both started at init by systemd. I noticed yesterday that my eMMC flash was completely full, and the reason was I had 1.8 gigs of log files. It seems that the standard output of these scripts (they generate a good amount of data for debugging purposes) is being logged to both /var/log/syslog and /var/log/daemon.log. Also, /var/log/messages has a ton of entries about "rate-limiting".

Now, I assume I could fix this by disabling standard output on these scripts. However, I would much rather preserve that capability and somehow tell systemd not to log that data. However, I've been unable to find information on this.

Here is an example of my current .service file:

[Unit]
Description=Description of my process
After=network.target
[Service]
Type=simple
ExecStart=/opt/myprocess
[Install]
WantedBy=multi-user.target

I should note that I originally had syslog.target as an "After" target, just because the example I was following had it. But I have since removed it and it doesn't seem to solve the problem.

Any help or insight into this problem would be greatly appreciated.

Edit: I may have found the answer here:

http://www.kibinlabs.com/systemd-logging-tricks/

Adding StandardOutput=null and seeing if that fixes it. Looks promising.

Edit 2: It does.

2

There are 2 answers

0
larsks On BEST ANSWER

SystemD does not log files in /var/log by itself, ever.

If log messages are showing up in /var/log, this suggests that your system is running a "syslog" daemon, which is receiving log messages either (a) by reading the systemd journal, or (b) by applications using syslog directly.

Simply disabling your syslog daemon would prevent files from being written in /var/log. Messages will still be written to the system journal, but there are fairly flexible controls available to you to limit the space used by these files. See the journald docs for more information.

0
Taha Jahangir On

Set ForwardToSyslog=no in /etc/systemd/journald.conf (default is yes) and restart systemd-journald