728x90
반응형

설치 확인

# rpm -qa | grep logrotate
logrotate-3.8.6-17.el7.x86_64

없을 때
yum instal logrotate

설정 경로

/etc/logrotate.d

각 설정 또는 예

# cat nginx
/var/log/nginx/*.log {
        daily
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 nginx adm
        sharedscripts
        postrotate
                if [ -f /var/run/nginx.pid ]; then
                        kill -USR1 `cat /var/run/nginx.pid`
                fi
        endscript
}



# cat munin-node
/var/log/munin-node/munin-node.log {
	missingok
	notifempty
	copytruncate
}



# cat syslog
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
    missingok
    sharedscripts
    postrotate
	/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}



# cat zabbix-agent
/var/log/zabbix/zabbix_agentd.log {
	weekly
	rotate 12
	compress
	delaycompress
	missingok
	notifempty
	create 0664 zabbix zabbix
}

 

옵션 참조

728x90
300x250

+ Recent posts