awstats日志分析小结(1)

本文介绍如何使用AWStats工具分析不同Web服务器(如Apache、Tomcat、Nginx、Squid和Lighttpd)的日志文件。通过修改配置文件,可以实现对访问日志的有效解析和统计。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

awststs是一个非常好用的日志统计工具,下面我对其他主要Web Server/proxy(nginx,squid,lighttpd,httpd)的日志如何进行分析展开说明。
在awstats配置修改最小的前提说明如何如何进行修改,希望对有需要的朋友能够提供帮助。

[color=red]awstats日志分析之apache[/color]
apache:
修改%apache%/conf/httpd.conf
修改为:
CustomLog logs/access_log combined
awstats:
awstats.xxx.conf
LogFile="%apache%/logs/access_log"即可
LogType=W
LogFormat=1


[color=red]awstats日志分析之tomcat[/color]
修改%tomcat%/conf/server.xml
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->
修改为:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".log" pattern="combined" fileDateFormat="yyyy-MM-dd" resolveHosts="false"/>
awstats.xxx.conf
LogFile="%tomcat%/logs/access_log.%yyyy%mm%dd.log"即可
LogType=W
LogFormat=1

[color=red]awstats日志分析之nginx[/color]
修改:%nginx%/conf/nginx.conf


#log_format main '$remote_addr - $remote_user [$time_local] $request '
# '"$status" $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;
修改为:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';

access_log logs/access.log main;
awstats.xxx.conf
LogFile="%nginx%/logs/access.log."即可
LogType=W
LogFormat=1


[color=red]awstats日志分析之squid[/color]
修改:%squid%/etc/squid.conf

access_log /usr/local/opt/squid//var/logs/access.log squid
修改为:

logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
access_log /usr/local/opt/squid/var/logs/access.log combined
LogFile="%squid%/var/log/access.log."即可
LogType=W
LogFormat=1

[color=red]awstats日志分析之lighttpd[/color]
awstats直接支持lighttpd默认的日志输出格式。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值