分隔apache日誌

2021-06-29 16:42:31 字數 639 閱讀 3975

大家都知道,預設apache的預設日誌,是直接全部生成訪問日誌 access.log 和 錯誤日誌 error.log

但是隨著時間長了,日誌檔案是非常大,特別是大流量的**日誌都上百m的,

太恐怖了。嚴重影響伺服器連線速度。

怎麼去讓apache訪問日誌和錯誤日誌按照日期進行歸類?

其實也比較簡單:

apache的配置檔案中有這樣一段**:

1errorlog logs/error.log

這是錯誤日誌的**:

我們改下,

1#errorlog "logs/error.log"

2errorlog "|bin/rotatelogs.exe logs/error_%y_%m_%d.log 86400 480"

再看訪問日誌:

customlog "logs/access.log common"

更改為:

customlog "|bin/rotatelogs.exe logs/access_%y_%m_%d.log 86400 480" common

Nginx 日誌分隔

bin bash access log dir source opt logs dir report opt htdocs domain public access log cd dir source mkdir p dir report date y date m mv domain.log di...

如何將Apache日誌檔案按時間分隔儲存

如何將apache日誌檔案按時間分隔儲存 apahce的日誌檔案一般預設為單一檔案。如果日誌資訊太多,編輯器就無法正常開啟了,也不能很好的檢視。我們可以將日誌檔案按照天去劃分,每天儲存乙個新檔案。當然如果需要間隔更短或更長,比如按每小時儲存也是沒有問題的,具體就看每個人的需求了。首先需要用到apac...

nginx 日誌檔案分隔

nginx命令幫助如下 nginx h nginx version nginx 0.8.45 usage nginx hvvt s signal c filename p prefix g directives options h this help 幫助 v show version and ex...