mod_log_rotate

最後更新: 2017-09-27

介紹

 

在 Windows 上很有用, 因為 Windows 沒有 rsyslog, 所以做唔到 log rotate

Source: https://github.com/JBlond/mod_log_rotate

 


安裝

 

Copy mod_log_rotate.so to your Apache 2.4.x modules folder

LoadModule log_rotate_module modules/mod_log_rotate.so

 


設定

 

# Enable

RotateLogs On

# Normally the log rotation interval is based on UTC.
# "on": log rotation is timed relative to the local time.

RotateLogsLocalTime  On

# Set the interval in seconds for log rotation. (Default: 86400)
# RotateInterval <interval> [<offset>]
# i.e. 7 days @ 00:00

RotateInterval  604800

 


Log format

 

Default

  • access.log.1506512460
  • access.log.1506512520
  • access.log.1506512580

* error.log 是不會 rotate 的

更新 log filename

CustomLog "logs/access-%Y%m%d-%H%M%S.log" common

 


 

Creative Commons license icon Creative Commons license icon