編輯Apache設定檔httpd.conf,以變更記錄檔備存方式。
找到[access log]這段位置,進行設定:
[access log]
# 將原本設定註解
# CustomLog logs/access_log
# 新增設定(每天備存一次,86400秒 = 一天)
CustomLog "|/usr/sbin/rotatelogs /var/log/httpd/access_log.%Y-%m-%d 86400" common
找到[error log]這段位置,進行設定:
[error log]
# 將原本設定註解
# ErrorLog logs/error_log
# 新增設定(檔案超過40M備存一次)
ErrorLog "|/usr/sbin/rotatelogs /var/log/httpd/error_log.%Y-%m-%d 40M"