Popular
Latest Articles
- How to Secure your Cisco Router
- Creating CLI Views on a Cisco Router
- Configuring TACACS+ on a Cisco Router
- How to enable SDM on your router
- Build a Samba Server on Redhat / CentOS
- How to set the Time / Date and Timezone in CentOS
- How to install SSH on Solaris 10 x86
- ESX4 - How do I turn on/off a Virtual Machine from the command line ?
UNIX - Logrotate - Quick Guide
Tuesday, 29 July 2008 14:41
Logrotate, when run uses the /etc/logrotate.conf file by the logrotate script (which is found in the /etc/cron.daily /weekly ).
- /etc/crontab - dictates when the crons run (at which times , dates).
- /etc/cron.daily/weekly - contains the logrotate script when runs the logrotate command and.conf file.
An example logrotate.conf file,
root@bigdaddy# vim /etc/logrotate.conf
/var/log/local2.log {
rotate 5
daily
compress
create
missingok
#Close and open syslogd files after rotating logs
postrotate
kill -HUP `cat /var/run/syslogd.pid`
endscript
}
Note : You shouldnt use wildcard characters (i.e *) as this can cause you to log rotate already rotated logs.
For troubleshooting you can run the command directly using the force and verbose options to see exactley what is happening,
/usr/sbin/logrotate /etc/logrotate.conf -fv
2 great links can be found at,
We have 31 guests online