how do you configure rotation of syslog log files on ubuntu?
in my /etc/syslog.conf, i have this line:
local1.* /var/log/log.txt
over time, the following backup files have appeared:
/var/log/log.txt.0.gz /var/log/log.txt.1.gz
how do i开发者_如何学运维 configure how often these files get generated, and how to clean them out?
Ubuntu uses two log rotation mechanisms.
System log files which are configured via /etc/syslog.conf are rotated through /etc/cron.*/sysklogd which in turn uses /usr/sbin/syslogd-listfiles to get the list of files which need to be rotated.
The other tool is logrotate which is configured through /etc/logrotate.conf and scripts in /etc/logrotate.d
The advantage of the sysklogd mechanism is that new syslog files added to syslog.conf are automatically rotated without writing an extra logrotate script.
syslogd-listfiles is a bit complex and it rotates some logfiles on a daily bases which is not always useful on an inactive system.
So I set $everything=0 ;
to disable the daily rotation of . syslog entries thus making the default to rotate purely based on log file size.
精彩评论