User Tools

Site Tools


wiki:nginx_log_parsing

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
wiki:nginx_log_parsing [2022/04/13 12:47] – created antisawiki:nginx_log_parsing [2022/04/14 11:41] (current) – [nginx log parsing] add WRAP tags to nginx log line antisa
Line 1: Line 1:
-{{tag>nginx}}+{{tag>nginx log}}
  
 ====== nginx log parsing ====== ====== nginx log parsing ======
-Get number of request per second by country:+Get number of request per second by country if you have geoip logging enabled, with log line looking like this
  
-  cat /var/log/nginx/access.log | awk '{print $4}' | uniq -c | sort -rn | head+<WRAP prewrap> 
 +<code> 
 +"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=-  
 +</code> 
 +</WRAP>
  
 +then use this command:
  
 +  cat /var/log/nginx/access.log | awk '{print $4}' | uniq -c | sort -rn | head
 ====== Tested on ====== ====== Tested on ======
   *    * 
wiki/nginx_log_parsing.1649846854.txt.gz · Last modified: 2022/04/13 12:47 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