我正在尝试使用AWStats 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中描述,但我没有看到如何处理被引用的主机或时间戳(并且时间戳不在括号中)。