Awstats日志格式错误?

我已经经历了一段时间的awstats文档,它似乎与Logformat失败。

我在awstats中使用以下内容,

LogFormat = "%host - - %host_r %time1 %methodurl %code %bytesd %refererquot %uaquot %otherquot" 

(来自nginx

  log_format main '$remote_addr - $remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; 

样本点击次数: http : //pastebin.com/raw.php?i = qD9PKN52

我认为你错过了"在你的日志行上的一些对象的周围,你周围的其他人不需要它们。

尝试

  log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; 

确实如此。 从$状态中删除“”,并把它们放到$请求应该可以解决这个问题。

另外,如果您已经像我一样拥有大量的“损坏”日志,则可以运行:

 sed -i "s/00\]\ /00\]\ \"/g" access.log 

 sed -i "s/\(HTTP\/[0-9].[0-9]\)\ \"\([0-9][0-9][0-9]\)\"/\1\"\ \2/g" access.log 

这将使旧日志可用于awstats。