如何让 awstats 读取此日志格式?

发布于 2024-10-01 18:38:09 字数 1130 浏览 0 评论 0原文

我有一个包含多个子域的站点,所有子域都记录到同一个 access_log 文件中。由于文件可能太大,我有一个脚本将每个子域 grep 到它自己的文件中。

我在 Apache 中有一个自定义日志文件格式,如下所示:

"\"%{Host}i\" %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""

我的日志文件中的一行如下所示:

"brand.mysite.com" 176.32.1.18 - - [24/Oct/2010:11:24:45 -0400] "GET /Product/lookup HTTP/1.1" 200 5585 "http://www.customerhomepage.com/brand_name.htm" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR 1.1.4322)"

日志格式中有 10 个项目,日志中有 10 个项目。查看。

我正在尝试使用 awstats 在我的 awstats 配置文件中使用以下 Logformat 来分析这些内容:

LogFormat="\"%host_r\" %host %logname %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"

唯一的输出我从 awstats 获得的是每月历史记录部分。其他一切要么是空白,要么是零。

我的生成脚本如下所示:

rm stats/*.txt
cat access_log | grep brand > brand_access_log
perl tools/awstats_updateall.pl -configdir=wwwroot/cgi-bin -awstatsprog=wwwroot/cgi-bin/awstats.pl now
perl tools/awstats_buildstaticpages.pl -dir=stats -output=pagetype -config=brand -awstatsprog=wwwroot/cgi-bin/awstats.pl

我做错了什么?

I have a site with several subdomains, all subdomains are logged to the same access_log file. Since the file can be so huge, I have a script that greps out each subdomain into its own file.

I have a custom log file format in Apache like so:

"\"%{Host}i\" %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""

A line from my log file looks like this:

"brand.mysite.com" 176.32.1.18 - - [24/Oct/2010:11:24:45 -0400] "GET /Product/lookup HTTP/1.1" 200 5585 "http://www.customerhomepage.com/brand_name.htm" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR 1.1.4322)"

10 items in the log format, 10 items in the log. Check.

I'm trying to analyze these with awstats with the following Logformat in my awstats config file:

LogFormat="\"%host_r\" %host %logname %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"

The only output I get from awstats is from the Monthly History section. Everything else is either blank or zero.

My generation script looks like this:

rm stats/*.txt
cat access_log | grep brand > brand_access_log
perl tools/awstats_updateall.pl -configdir=wwwroot/cgi-bin -awstatsprog=wwwroot/cgi-bin/awstats.pl now
perl tools/awstats_buildstaticpages.pl -dir=stats -output=pagetype -config=brand -awstatsprog=wwwroot/cgi-bin/awstats.pl

What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南街女流氓 2024-10-08 18:38:09

我没有意识到我可以剪切并粘贴 Apache LogFormat 指令(带有 = 符号)并且它会起作用,我以为我被迫使用 awstats。

awstats 将使用 httpd.conf 文件中的 LogFormat 指令并将其替换为 awstats 标识符。

我直接从 Apache2 httpd.conf 将其剪切并粘贴到我的 awstats.whatever.conf 文件中(然后在 LogFormat 之后添加 = 符号):

LogFormat="\"%{Host}i\" %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""

I didn't realize I could just cut and paste the Apache LogFormat directive (with an = sign) and it would work, I thought I was forced to use awstats.

awstats will use the LogFormat directive from your httpd.conf file and replace it with the awstats identifiers.

I cut and pasted this into my awstats.whatever.conf file directly from my Apache2 httpd.conf (and then added the = sign after LogFormat):

LogFormat="\"%{Host}i\" %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文