"Logrotate"의 두 판 사이의 차이

30번째 줄: 30번째 줄:
<source lang='dos'>
<source lang='dos'>
[root@jmnote ~]# ll /etc/logrotate.d
[root@jmnote ~]# ll /etc/logrotate.d
total 32
total 84
-rw-r--r--. 1 root root  71 Jun 22 2012 cups
-rw-r--r-- 1 root root  144 Feb 23 2012 acpid
-rw-r--r--. 1 root root 103 Jun 22 2012 dracut
-rw-r--r-- 1 root root  288 Nov 12  2007 conman
-rw-r--r--. 1 root root 185 Feb 7 2012 httpd
-rw-r--r-- 1 root root  180 Nov 25 2012 httpd
-rw-r--r--. 1 root root 136 Aug 22  2010 ppp
... (생략)
-rw-r--r--. 1 root root 329 Jun 22  2012 psacct
-rw-r--r--. 1 root root 210 May 17  2012 syslog
-rw-r--r--. 1 root root 100 Jun 22  2012 wpa_supplicant
-rw-r--r--. 1 root root 100 Jun 22  2012 yum
</source>
</source>
<source lang='dos'>
<source lang='dos'>
46번째 줄: 42번째 줄:
     notifempty
     notifempty
     sharedscripts
     sharedscripts
    delaycompress
     postrotate
     postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
/bin/kill -HUP `cat /var/run/httpd/httpd.pid 2>/dev/null` 2> /dev/null || true
     endscript
     endscript
}
}

2014년 2월 2일 (일) 13:25 판

1 개요

logrotate
로그 로테이트
/usr/sbin/logrotate
  • 시스템 로그 순환, 압축, 메일발송 자동화

2 기본 설정

CentOS 기본 설정이다.

[root@jmnote ~]# cat /etc/logrotate.conf | egrep -v "^[[:space:]]*$" | grep -v ^#
weekly
rotate 4
create
dateext
include /etc/logrotate.d
/var/log/wtmp {
    monthly
    create 0664 root utmp
	minsize 1M
    rotate 1
}
/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}
/etc/logrotate.conf에는 wtmp, btmp에 대한 것만 있고, 다른 로그에 대해서는 /etc/logrotate.d 폴더에 설정한다.
[root@jmnote ~]# ll /etc/logrotate.d
total 84
-rw-r--r-- 1 root root  144 Feb 23  2012 acpid
-rw-r--r-- 1 root root  288 Nov 12  2007 conman
-rw-r--r-- 1 root root  180 Nov 25  2012 httpd
... (생략)
[root@jmnote ~]# cat /etc/logrotate.d/httpd
/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
	/bin/kill -HUP `cat /var/run/httpd/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}