寻找Apache日志的方法

找到httpd.conf文件的位置

这篇文章对我很有帮助。

 

请确认httpd.conf文件中的日志位置。

使用httpd.conf文件

CustomLog をgrep→ログのパスとどのフォーマットを使ってるかチェック(ログのパスはServerRootからの相対パスになっているのでServerRootもgrepする)

ServerRoot "/etc/httpd"
CustomLog "logs/access_log" combined env=!nolog

→ “可以在/etc/httpd/logs/access_log找到日志文件位置,其格式为combined。”

请检查格式。

    httpd.confでLogFormat をgrep→実際のフォーマットをチェック
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

→ 「由于在此服务器上使用了combined,因此日志的格式为 %h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”。」

这里可以参考格式的查看方式
https://qiita.com/ryounagaoka/items/e7782ab29ff9fbe8f891

广告
将在 10 秒后关闭
bannerAds