溫馨提示×

Apache日志在CentOS上如何分析

小樊
39
2025-08-16 16:52:31
欄目: 智能運維

一、日志文件位置

  • 訪問日志/var/log/httpd/access_log
  • 錯誤日志/var/log/httpd/error_log

二、常用命令行工具

  • 查看實時日志tail -f /var/log/httpd/access_log
  • 搜索特定信息grep "關鍵字" /var/log/httpd/access_log
  • 統計IP訪問次數awk '{print $1}' /var/log/httpd/access_log | sort | uniq -c | sort -nr
  • 分析狀態碼grep " 404 " /var/log/httpd/access_log

三、圖形化工具

  • Webalizer:生成圖表報告,需安裝配置。
  • Awstats:支持詳細統計,需安裝配置。
  • ELK Stack:實時分析,需部署Logstash、Elasticsearch、Kibana。

四、日志輪替管理

使用logrotate工具自動壓縮、刪除舊日志,配置文件為/etc/logrotate.d/httpd。

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