Windows/Linux停Apache日志按日期分类输出配置

Windows/Linux下Apache日志按日期分类输出配置

Windows下更改apache httpd.conf配置:

 

错误日志:ErrorLog "| /bin/rotatelogs.exe /logs/error_%Y_%m_%d.log 86400 480"

 

说明 :1.开头红色的杠杠千万不要忘记 这是标明后面rotatelogs.exe的目录的 

         2.蓝色的路径是rotatelogs.exe还有errorlog的文件路径中间有空格的啊  也就是rotatlogs.exe的路径 空格 errorlog的路径

         3.后面的数字不用修改就写这个就行了,是说明文件大小的

 

访问日志:CustomLog "|/bin/rotatelogs.exe /logs/access_%Y_%m_%d.log 86400 480" combined

 

(对应的LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined )也可以自己配置 但要对应上

 

Linux下更改apache httpd.conf配置:

 

原理跟windows差不多,就是不是导入rotatelogs的Exe文件

 


错误日志:ErrorLog " | /bin/rotatelogs  /logs/error_%Y_%m_%d.log 86400 480"

访问日志:  CustomLog "|/bin/rotatelogs /logs/access_%Y_%m_%d.log 86400 480" combined