How to rotate logs manually in Linux?

Posted by linuxnix on Feb 23, 2016 11:18 AM EDT
www.linuxnix.com; By Surendra kumar
Mail this story
Print this story

In Linux every activity is monitored and logged in to their respective logs in /var/log folder. The depth of log information is dependent on the log configuration we did it in /etc/logrotate.d and we have to rotate them all the time to control how much space they use.

In Linux every activity is monitored and logged in to their respective logs in /var/log folder. The depth of log information is dependent on the log configuration we did it in /etc/logrotate.d and we have to rotate them all the time to control how much space they use. When ever we install packages, the package copies its log configuration file to /etc/logrotate.d folder so that that specific application log files can be rotated.

Normally in any Linux/Unix machine logs are rotated daily(/etc/cron.daily/) or weekly(/etc/cron.weekly) or monthly(/etc/cron.monthly) depending where we kept our logrotate script. My logrotate script is located in /etc/cron.daily which indicate my logs are rotated daily. One more facter logrotate depends when rotatting logs is log "status" file which is located at /var/lib/logrotate/status which stores when we rotated logs last time.

Let us see how we can rotate logs manually instead of waiting for hours.

Example1: In order to check what happens when we rotate log files manually before actually executing them can be done in debug mode(-d).

Full Story

  Nav
» Read more about: Groups: Linux

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.