標籤:blog http io os 使用 strong 檔案 div on
httpd.conf中CustomLog logs/access.log common 改成
CustomLog "|c:/apache/bin/rotatelogs.exe c:/apache/logs/access_%Y_%m_%d.log 86400" common
其中把c:改成你安裝apache所在的路徑.
重啟Apache
其中c:/apache/是你安裝apache的路徑這樣每一天產生一個記錄檔
-
在apache的設定檔中找到
ErrorLog logs/error_log
CustomLog logs/access_log common
Linux系統配置方法:
將其改為
ErrorLog "| /usr/local/apache/bin/rotatelogs /home/logs/www/%Y_%m_%d_error_log 86400 480"
CustomLog "| /usr/local/apache/bin/rotatelogs /home/logs/www/%Y_%m_%d_access_log 86400 480" common
Windows系統下配置方法:
#ErrorLog "|bin/rotatelogs.exe logs/vicp_net_error-%y%m%d.log 86400 480"
#CustomLog "|bin/rotatelogs.exe logs/vicp_net_access-%y%m%d.log 86400 480" common
第一次不知道設定480這個參數,導致日誌記錄時間和伺服器時間相差8小時,原來是rotatelogs有一個offset參數,表示相對於UTC的時差分鐘數,中國是第八時區,相差480分鐘。86400是表示1天。
附rotatelogs說明
rotatelogs logfile [ rotationtime [ offset ]] | [ filesizeM ]
選項
logfile
它加上基準名就是記錄檔名。如果logfile中包含’%‘,則它會被視為用於的strftime(3)的格式字串;否則,它會被自動加上以秒為單位的.nnnnnnnnnn尾碼。這兩種格式都表示新的日誌開始使用的時間。
rotationtime
記錄檔回卷的以秒為單位的間隔時間
offset
相對於UTC的時差的分鐘數。如果省略,則假定為0,並使用UTC時間。比如,要指定UTC時差為-5小時的地區的當地時間,則此參數應為-300。
filesizeM
指定回卷時以MB為單位的尾碼字母M的檔案大小,而不是指定回卷時間或時差。
---------------
httpd.conf中CustomLog logs/access.log common 改成
CustomLog "|c:/apache/bin/rotatelogs.exe c:/apache/logs/access_%Y_%m_%d.log 86400" common
其中把c:改成你安裝apache所在的路徑.
重啟Apache
其中c:/apache/是你安裝apache的路徑這樣每一天產生一個記錄檔
利用apache內建的工具 分割訪問日誌