apache分(fēn)割日志記錄或關(guān)閉日志

天遠(yuǎn)科技  發表于:2015-12-16  分(fēn)類:Web Serve  閱讀(3578)  贊同27

apache自帶了(le)一(yī)個(gè)日志程序rotatelogs,如(rú)果你的apache安裝在/usr/local/apache目錄,則應用是在/usr/local/apache/bin/rotatelogs。

打開apache配置文件 vi /usr/local/apache/conf/httpd, 找到CustomLog "logs/access_log" common 将此行改為(wèi)

CustomLog "|/usr/local/apache/bin/rotatelogs  /mylogs/httpd/access_log_%Y-%m-%d  86400 480" combined  //意思是1天記錄一(yī)個(gè)文件apache訪問日志

CustomLog "|/usr/local/webserver/apache/bin/rotatelogs  /data/logs/httpd/access_log_%Y-%m-%d  2M" combined  //超出2M生(shēng)成一(yī)個(gè)新(xīn)日志

當然可以前面加#,則apache将不産生(shēng)訪問日志

找到 ErrorLog "logs/error_log"

改為(wèi)

ErrorLog "|/usr/local/apache/bin/rotatelogs  /mylogs/httpd/error_log_%Y-%m-%d  86400"   //每天産生(shēng)一(yī)個(gè)錯誤日志文件

ErrorLog "|/usr/local/apache/bin/rotatelogs  /mylogs/httpd/error_log_%Y-%m-%d  86400" common


ErrorLog "|/usr/local/apache/bin/rotatelogs  /mylogs/httpd/error_log_%Y-%m-%d  1M"  //每天産生(shēng)一(yī)個(gè)1M的錯誤日志文件

ErrorLog "|/usr/local/apache/bin/rotatelogs  /mylogs/httpd/error_log_%Y-%m-%d  1M" common




在線聯系
點擊這(zhè)裏給我發消息
點擊這(zhè)裏給我發消息
關(guān)注我們