Debian系統上的Apache服務器主要記錄兩種類型的日志:訪問日志(access log)和錯誤日志(error log)。
訪問日志記錄了所有對Apache服務器的請求,包含以下信息:
訪問日志的格式通常為“common”或“combined”格式:
Common Log Format (CLF):
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
Combined Log Format(比CLF多兩個字段:Referer和User-Agent):
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98;I ;Nav)"
錯誤日志記錄了Apache服務器運行時出現的錯誤和診斷信息。日志級別可以配置為不同的詳細程度,例如emerg, alert, crit, error, warn, notice, info, 和 debug。錯誤日志幫助管理員排查服務器運行中的問題。
在Debian系統中,這些日志文件通常位于 /var/log/apache2/
目錄下:
access.log
:存儲訪問日志error.log
:存儲錯誤日志通過分析這些日志,管理員可以了解網站的訪問情況、識別潛在的安全問題以及優化網站性能。