溫馨提示×

Apache在CentOS上的日志如何查看

小樊
43
2025-08-18 17:10:34
欄目: 智能運維

Apache在CentOS上的日志默認存放在/var/log/httpd/目錄下,主要包含訪問日志(access_log)和錯誤日志(error_log),查看方式如下:

  • 實時查看
    sudo tail -f /var/log/httpd/access_log(訪問日志)
    sudo tail -f /var/log/httpd/error_log(錯誤日志)
  • 分頁查看
    sudo less /var/log/httpd/access_log(支持上下翻頁,按q退出)
  • 搜索特定內容
    sudo grep "關鍵字" /var/log/httpd/access_log(替換為需搜索的內容,如IP、錯誤碼)
  • 查看完整日志(小文件適用):
    sudo cat /var/log/httpd/access_log

注意:若日志路徑因配置修改,可通過grep -R "Log" /etc/httpd/查找實際路徑。部分命令需root權限,建議加sudo。

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女