1

我在这个社区的第一个问题,希望这里会很棒!

主题:我有这个非常简单的日志文件,按以下方式构建

192.168.178.21 [21/07/2015] "GET /path/to/somewhere HTTP/1.1" "/path/to/somewhere" "Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0"

以及以下用于 goaccess 的配置文件

date-format %d/%m%Y
log-format %h %^[%d%^] "%r" "%U" %^

附带问题:

由于我查看了与该主题相关的所有问题,因此找不到错误的原因

GoAccess - version 0.8.5 - Dec  5 2014 06:28:46
Fatal error has occurred
Error occurred at: goaccess.c - main - 832
Nothing valid to process.

该文档还指出,正确解析只需要 %h、"%r" 和 %d。我错过了什么?

添加。信息

  • CentOS 7 64位
  • GoAccess 0.8.5

我知道截至今天的最新版本是 0.9.2。出于“原因”,我无法自己构建最新版本。所以也许这是一个取决于版本的问题(?)。

4

1 回答 1

1

看来您发布的日期格式不正确。尝试以下方法,它对我有用:

goaccess -f log --log-format='%h [%d] "%r" "%^" "%u"' --date-format='%d/%m/%Y' --time-format="%T"

您必须同时使用 ,date_formatlog_format, 我也认为time_format(至少在最新版本中)。

该变量date_format指定日期格式,同时log_format包含 goaccess 用于解析访问日志中每一行的标记。

于 2015-08-22T19:21:54.090 回答