CentOS7 log rotation configuration template

Overview

The log rotation setting of CentOS7 is required "occasionally", but (that's why) I forget it every time and go to the set server, so I will write it here. For those who want to know only the main points quickly!

Setup steps

Create configuration file

<filename> is optional.

vim /etc/logrotate.d/<filename>

Setting input

Describe the following in /etc/logrotate.d/<filename> created above

/etc/logrotate.d/filename


<target file> {
    weekly
    rotate 7
    missingok
    notifempty
    copytruncate
    compress
    dateext
    dateformat _%Y%m%d
    minsize 1M
}

The setting itself is complete.

bonus

I will add a description of the above settings ...

Recommended Posts

CentOS7 log rotation configuration template
Perform log rotation on centos