Apache

logrotate 설정

뱀고기* 2016. 2. 25. 10:08

1. /etc/logrotate.d

/var/log/httpd/*log {

  daily

  rotate 10

  missingok

  notifempty

  sharedscripts

  delaycompress

  postrotate

    /sbin/service httpd reload > /dev/null 2>/dev/null || true

  endscript

}


2. cd /var/log

cp -arf httpd httpd_bak

cd httpd

rm -f *


3. /etc/init.d/httpd restart



추가적으로 버츄얼호스트마다 도메인명으로 로그 생기게 해주면 더 좋음

vi /etc/httpd/conf/vhosts.conf

ErrorLog /var/log/httpd/도메인명.error_log

CustomLog /var/log/httpd/도메인명.access_log combined