Rotation of ogo.log
Logrotation of ogo.log
This simple how-to shows the way to rotate ogo.log in a Mandrake 9.x system, in order to avoid a very large log file
Pre requisite
Package logrotate must be installed.
Preamble
Logrorate configuration is located in /etc. One file and one directory are important.
/etc/logrotate.conf
/etc/logrotate.d
In Mandrake Linux, there is no need to modify /etc/logrotate.conf. The file has a include clause that will execute log rotation of all files defined in the /etc/logrotate.d directory. Therefore it will be necessary to add the ogo.log stuffs in /etc/logrotate.d
Create a file named ogo with the following contents:
[root@opengroupware log]# cat /etc/logrotate.d/ogo
/var/log/ogo.log {
daily
notifempty
missingok
prerotate
/sbin/service opengroupware stop
endscript
postrotate
/sbin/service opengroupware start
endscript
}
Voilà. That's all needed.
Obs. Thank's Helge for the pre-rotate stuff.
Operation:
Logorotate binary will be activated by cron, on a daily base. If your Mandrake system is running fine, this will be activated automatically. If you prefer to rotate log on a weekly base, change "daily" to "weekly" above.