User Tools

Site Tools


wiki:nginx_log_parsing

This is an old revision of the document!


nginx log parsing

Get number of request per second by country if you have geoip logging enabled, with log line looking like this

“14/Apr/2022:00:01:29 +0200” client=114.119.147.209 country=CN is_bot=1 method=GET request=“GET /marken/giorgio-armani/kurzarmhemden/ HTTP/1.1” request_length=414 status=200 bytes_sent=37876 body_bytes_sent=37376 referer=- user_agent=Mozilla/5.0 (Linux; Android 7.0;) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; PetalBot;+https://webmaster.petalsearch.com/site/petalbot) upstream_addr=127.0.0.1:8443 upstream_status=200 request_time=0.146 upstream_response_time=0.144 upstream_connect_time=0.004 upstream_header_time=0.140 upstream_cache_status=MISS cookie_mbbauth_present=0 isFilter=1 main_upstream=filter cookie_gender=- cookie_abtest=-

cat /var/log/nginx/access.log | awk '{print $4}' | uniq -c | sort -rn | head

Tested on

See also

References

wiki/nginx_log_parsing.1649924348.txt.gz · Last modified: 2022/04/14 10:19 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki