2

我正在尝试使用 AStats 7.0 来解析 Glassfish 4 HTTP 访问日志。这是一个示例行:

"65.112.10.87" "NULL-AUTH-USER" "06/Mar/2018:05:22:41 -0500" "GET / HTTP/1.1" 200 52598

我正在运行awstats_updateall.pl now并收到以下错误:

Running '"/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -update -config=localhost.localdomain -configdir="/etc/awstats"' to update config localhost.localdomain
Create/Update database for config "/etc/awstats/awstats.localhost.localdomain.conf" by AWStats version 7.0 (build 1.971)
From data in log file "/usr/local/glassfish4/glassfish/domains/domain1/logs/access/server_access_log.2018-03-06.txt"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read of your log.
Your log file /usr/local/glassfish4/glassfish/domains/domain1/logs/access/server_access_log.2018-03-06.txt must have a bad format or LogFormat parameter setup does not match this format.
Your AWStats LogFormat parameter is:
%host %otherquot %time1 %methodurl %code %bytesd
This means each line in your web server log file need to have the following personalized log format:
%host %otherquot %time1 %methodurl %code %bytesd
And this is an example of records AWStats found in your log file (the record number 50 in your log):
"65.112.10.87" "NULL-AUTH-USER" "06/Mar/2018:05:22:41 -0500" "GET / HTTP/1.1" 200 52598 
Setup ('/etc/awstats/awstats.localhost.localdomain.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

正如您在上面的错误中看到的,我的 LogFormat 设置为以下内容:

LogFormat = "%host %otherquot %time1 %methodurl %code %bytesd"

我认为问题在于 Glassfish 日志中的所有值都被引用,如下所示:

"65.112.10.87" "NULL-AUTH-USER" "06/Mar/2018:05:22:41 -0500" "GET / HTTP/1.1" 200 52598

https://serverfault.com/questions/829694/looking-for-logformat-for-awstats-to-read-my-custom-apache-logfiles/830071提到了一种似乎试图处理双引号的语法,ref=\"%referer\"例如但我已经尝试过类似的东西%time1,但它似乎对我不起作用(而且我找不到任何关于这种语法的文档)。\"%time1\"也不行。

有人可以帮我找出正确的LogFormat定义吗?http://www.awstats.org/docs/awstats_config.html#LogFormat中描述了这些选项,但我不知道如何处理引用的主机或时间戳(并且时间戳不在括号中)。

4

0 回答 0