有人能提供一个适用于 Discourse Docker 安装生成的 Nginx 日志的 goaccess 日志文件格式吗?我写起来有困难。
1 个赞
好吧,我来回答自己的问题……
Docker 容器中的日志文件格式是:
log_format log_discourse ‘[$time_local] "$http_host" $remote_addr "$request" "$http_user_agent" "$sent_http_x_discourse_route" $status $bytes_sent "$http_referer" $upstream_response_time $request_time "$upstream_http_x_discourse_username" "$upstream_http_x_discourse_trackview" "$upstream_http_x_queue_time" "$upstream_http_x_redis_calls" "$upstream_http_x_redis_time" "$upstream_http_x_sql_calls" "$upstream_http_x_sql_time"’;
有一个实用脚本可以在 GitHub 上解析此内容并生成 .goaccess 日志文件格式:
这是输出:
time-format %T
date-format %d/%b/%Y
log_format [%d:%t %^] "%v" %h "%r" "%u" "%^" %s %b "%R" %^ %T "%^" "%^" "%^" "%^" "%^" "%^" "%^"
自己写这个相当困难。我认为这将来可能对其他人有用。
goaccess 程序是一个非常好的日志文件分析器。
2 个赞