hos to use logrotate command with its examples

  • About logrotate : Rotates, compresses, and mails system logs
  • It comes from “logrotate-3.7.8” package.
  • Configuration Files :

       /var/lib/logrotate.status  Default state file.
       /etc/logrotate.conf        Configuration options.

  • Path: /usr/sbin/logrotate

Examples:

1. To force the log rotation

$ logrotate -f /etc/logrotate.conf
$ logrotate –force /etc/logrotate.conf 

2. To test the log rotation

$ logrotate -d /etc/logrotate.conf
$ logrotate –debug /etc/logrotate.conf

3. To set to verbose mode

$ logrotate -v /etc/logrotate.conf
$ logrotate –verbose /etc/logrotate.conf

4. To get the help for logrotate

$ logrotate -?
$ logrotate –help

5. To display the brief usage help

$ logrotate –usage

 

Related Commands: gzip 

Leave a Reply

Your email address will not be published. Required fields are marked *