代码之家  ›  专栏  ›  技术社区  ›  RubyRedGrapefruit

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

  •  3
  • RubyRedGrapefruit  · 技术社区  · 14 年前

    我有一个站点有几个子域,所有子域都记录到同一个访问日志文件中。因为这个文件可能非常大,所以我有一个脚本,可以将每个子域分成自己的文件。

    我在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得到的唯一输出是来自每月的历史记录部分。其他的不是空白就是零。

    我的生成脚本如下:

    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
    

    我做错什么了?

    1 回复  |  直到 14 年前
        1
  •  3
  •   RubyRedGrapefruit    14 年前

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

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

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