Skip to content

Instantly share code, notes, and snippets.

@franciscocpg
Last active January 25, 2023 01:52
Show Gist options
  • Save franciscocpg/f9aebafbc093ea877837f0b3e9383805 to your computer and use it in GitHub Desktop.
Save franciscocpg/f9aebafbc093ea877837f0b3e9383805 to your computer and use it in GitHub Desktop.
Limit systemctl log

Edit the file below:

nano /etc/rsyslog.d/50-default.conf

Comment the line below:

#*.*;auth,authpriv.none         -/var/log/syslog

Add the following lines (limit to 2 GB in the example and remove the file when it reaches the limit)

$outchannel mysyslog,/var/log/syslog,2147483648,/bin/rm /var/log/syslog
*.*;auth,authpriv.none  :omfile:$mysyslog

Restart rsyslog service:

systemctl restart rsyslog.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment