Nginx traffic statistics
Nginx traffic statistics
1. Statistics of UV based on visiting IP
Awk'{print $1} 'access.log | sort | uniq-c | wc-l
two。 Statistics visit URL Statistics PV
Awk'{print $7} 'access.log | wc-l
3. Query the most frequently visited URL
Awk'{print $7} 'access.log | sort | uniq-c | sort-n-k 1-r | more
4. Query the most frequently visited IP
Awk'{print $1} 'access.log | sort | uniq-c | sort-n-k 1-r | more
5. View logs based on time period statistics
Cat access.log | sed-n'/ 14\ / Mar\ / 2015 Mar 21 Mar 14\ / Mar\ / 2015 Mar 22 p' | more