Simple NGINX log file analyzer [closed]

谁说我不能喝 提交于 2019-12-04 07:32:56

问题


I'm looking for a simple tool to analyze my NGINX logs on my macbook. I want to be able to get some basic stats including bot access and also be able to sort/filter the logs to find out what happened right before the server crashed.


回答1:


You may try with GoAccess; free and open source console based. It may output an HTML report too.




回答2:


I've come across visitors. It's written in C and is pretty fast.

It lacks goaccess' cool ncruses interface. It only outputs html. It does the job, though.

Edit: It can also output human-readable text reports:

visitors access.log | less



回答3:


I will suggest to use logstash and Kibana with following patterns :

for access.log :

NGINXACCESS %{IPORHOST:clientip} - %{USERNAME:remote_user} \[%{HTTPDATE:time_local}\] %{QS:request} %{INT:status} %{INT:body_bytes_sent} %{QS:http_referer} %{QS:http_user_agent}

for error.log:

 NGINXERROR (?<timestamp>%{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY}[- ]%{TIME}) \[%{LOGLEVEL:severity}\] %{POSINT:pid}#%{NUMBER}: %{GREEDYDATA:errormessage}(?:, client: (?<clientip>%{IP}|%{HOSTNAME}))(?:, server: %{IPORHOST:server})(?:, request: %{QS:request})?(?:, host: %{QS:host})?(?:, referrer: \"%{URI:referrer})?



回答4:


The request-log-analyzer gem now has Nginx support in the master branch and i'm looking for someone to test it. http://github.com/wvanbergen/request-log-analyzer.




回答5:


I've now tried Splunk, it's a pretty powerful tool and they have a free version as well.



来源:https://stackoverflow.com/questions/12589003/simple-nginx-log-file-analyzer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!