Wednesday, 23 July 2014

How to compress logs with logrotate?

By default, logs created in /var/log/  are rotated and depending of Linux distro that you use are compressed or not. Depending on how frequent rotation is your log files can be quite big. To avoid file system digestion, it is wise to compress old log files during rotation cycle.

To enable compression of log files in /etc/logrotate.conf uncomment compress statement

# uncomment this if you want your log files compressed

There is no need for restart of any service. During next logrotate cycle, new configuration will be executed. If you can not wait execute it manually

server#logrotate /etc/logrotate.conf

 and compressed logs will appear in /var/log folder. 

No comments: