美文网首页
Linux_222_Apache的access日志

Linux_222_Apache的access日志

作者: 为宇绸缪 | 来源:发表于2022-08-18 11:08 被阅读0次

定义访客日志格式
有时候我们需要定制apache默认显示的日志格式,增加或者减少日志记录的内容,更好的让运维人员掌握用户访问信息。
并且日志可能会给系统造成大量的IO操作,造成较多的负担,如果关闭日志功能,甚至可能提高40%的性能,那当然是不能关闭,而是调整日志级别。

查看httpd配置文件

vim /etc/httpd/conf/httpd.conf
搜索LogFormat
ErrorLog "logs/error_log" #错误日志存放位置
cd /etc/httpd/logs
里面有访问日志 access_log 和 错误日志 error_log
修改LogFormat就可以修改日志格式

image.png

日志级别

# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# 解释
emerg 紧急 - 系统无法使用。 "Child cannot open lock file. Exiting"
alert 必须立即采取措施。 "getpwuid: couldn't determine user name from uid"
crit 致命情况。 "socket: Failed to get a socket, exiting child"
error 错误情况。 "Premature end of script headers"
warn 警告情况。 "child process 1234 did not exit, sending another SIGHUP"
notice 一般重要情况。 "httpd: caught SIGBUS, attempting to dump core in ..."
info 普通信息。 "Server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers)..."
debug 出错级别信息 "Opening config file ..."

一般使用error或者warning

相关文章

网友评论

      本文标题:Linux_222_Apache的access日志

      本文链接:https://www.haomeiwen.com/subject/ctregrtx.html