a nginx traffic statistics/analyse tool
it can
- log every [5 minutes/1 huor/1 day] 's [ip / host / url / file on disk] requests and body size
- realtime statistics
- history log saved on disk
- log url referers relationship
it helps you
- find which ip or which file cause huge traffic
- compare files / hosts and their traffic usages, help you optimize load speed
how to use
-
build with golang
go build
-
edit allow_ip and allow_users file
-
config nginx, add log format (only support this format)
log_format traffic '$remote_addr "$host$request_uri" $body_bytes_sent "$request_filename" "$http_referer"';
-
set nginx access_log to
/tmp/nginx_traffic.log
which is a fifo created by ntraffstataccess_log /tmp/nginx_traffic.log traffic;
-
start ntraffstat and then reload nginx