让nginx用awstats来分析日志
其实这个方法在网上另外一篇文章已经有介绍,来自18m developerWorks
但是一个很xx的问题是,他里面有一个错误,其中在改nginx配置文件,让nginx打出apache格式日志的时候,他少了一对引号,多了一对引号,导致awstats不认这个日志。他原文的配置是:
‘$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 new_log; #日志生成路径
正确的格式应为:
‘$remote_addr – $remote_user [$time_local] “$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;
access_log /home/sharej/log/nginx/sharej.access.log default_log_sharej; #日志生成路径
这篇日志是每日一web-dev tip计划的一部分,如果你关注web开发或者linux,请订阅我的rss。
相关文章
- No Related Posts