CentOS 下 Apache 日志管理
一 日志位置与基础配置
二 日志轮转方案
/var/log/httpd/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 0640 root adm
sharedscripts
postrotate
systemctl reload httpd >/dev/null 2>&1 || true
endscript
}
ErrorLog "|/usr/sbin/rotatelogs /var/log/httpd/error_log.%Y-%m-%d 86400"
CustomLog "|/usr/sbin/rotatelogs /var/log/httpd/access_log.%Y-%m-%d 86400" combined
三 日志查看与分析
四 优化与维护要点