摘录自:
错误日志(Error Log)
Ubuntu下的默认路径:/var/log/apache2/error.log*
相关指令
* ErrorLog
* LogLevel
持续监视错误日志:
访问日志(Access Log)
Ubuntu下的默认路径:/var/log/apache2/access.log*
相关模块
* mod_log_config
* mod_setenvif
相关指令
* CustomLog
* LogFormat
* SetEnvIf
通用日志格式(Common Log Format):
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common
|
组合日志格式(Combined Log Format):
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog log/access_log combined
|
多文件访问日志:
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log common
CustomLog logs/referer_log "%{Referer}i -> %U"
CustomLog logs/agent_log "%{User-agent}i"
|
条件日志:
# 不记录本机发出的请求
SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
# 不记录对robots.txt文件的请求
SetEnvIf Request_URI "^/robots\.txt$" dontlog
# 记录其他请求
CustomLog logs/access_log common env=!dontlog
|
# 将使用英语的请求记录到一个日志,而记录非英语的请求到另一个日志
SetEnvIf Accept-Language "en" english
CustomLog logs/english_log common env=english
CustomLog logs/non_english_log common env=!english
|
日志滚动
mv access_log access_log.old
mv error_log error_log.old
apachectl graceful
sleep 600
gzip access_log.old
error_log.old
|
管道日志
CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log
86400" common
|
虚拟主机
LogFormat "%v %l %u %t \"%r\" %>s %b" comonvhost
CustomLog logs/access_log comonvhost
|
其他日志文件
相关模块
* mod_logio
* mod_log_forensic
* mod_cgi
* mod_rewrite
相关指令
* LogFormat
* ForensicLog
* PidFile
* RewriteLog
* RewriteLogLevel
* ScriptLog
* ScriptLogBuffer
* ScriptLogLength
阅读(220) | 评论(0) | 转发(0) |