Created
December 21, 2014 15:17
-
-
Save na0AaooQ/62a38a80394da827f6b6 to your computer and use it in GitHub Desktop.
logrotateによるApacheログローテーション設定 ref: http://qiita.com/na0AaooQ/items/ff2dad51b2b70d69ce87
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vi /etc/logrotate.d/httpd | |
/var/log/httpd/*log { | |
daily | |
missingok | |
rotate 7 | |
notifempty | |
sharedscripts | |
compress | |
delaycompress | |
postrotate | |
/sbin/service httpd reload > /dev/null 2>/dev/null || true | |
endscript | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# chmod 644 /etc/logrotate.d/httpd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# logrotate -dv /etc/logrotate.d/httpd | |
reading config file /etc/logrotate.d/httpd | |
reading config info for /var/log/httpd/*log | |
Handling 1 logs | |
rotating pattern: /var/log/httpd/*log after 1 days (7 rotations) | |
empty log files are not rotated, old logs are removed | |
considering log /var/log/httpd/access_log | |
log does not need rotating | |
considering log /var/log/httpd/error_log | |
not running postrotate script, since no logs were rotated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ls -lrt /var/log/httpd/ | |
(略) | |
-rw-r--r-- 1 root root 607 12月 20 03:09 error_log-20141219.gz | |
-rw-r--r-- 1 root root 2569 12月 20 03:09 access_log-20141219.gz | |
-rw-r--r-- 1 root root 2523077 12月 21 03:31 access_log-20141221 | |
-rw-r--r-- 1 root root 215 12月 21 03:32 error_log-20141220.gz | |
-rw-r--r-- 1 root root 50743 12月 21 03:32 access_log-20141220.gz | |
-rw-r--r-- 1 root root 332 12月 21 03:32 error_log-20141221 | |
-rw-r--r-- 1 root root 256 12月 21 03:32 error_log | |
-rw-r--r-- 1 root root 1931294 12月 21 20:41 access_log | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment