This is an old revision of the document!
Table of Contents
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