hits.1 (998B)
1 .Dd 2 .Dt HITS 1 3 .Sh NAME 4 .Nm hits 5 .Nd count web traffic 6 .Sh SYNOPSIS 7 .Nm 8 .Op Ar 9 .Sh DESCRIPTION 10 .Nm 11 counts HTTP requests from web server request log files 12 and reports the number of requests per path. 13 If no files are specified, 14 .Nm 15 reads from the standard input. 16 .Pp 17 The log must be in the default format produced by 18 OpenBSD's 19 .Xr httpd 8 20 and 21 .Xr nginx 8 . 22 Here is an example line: 23 .Dl default 192.0.2.1 - - [19/Dec/2022:23:12:34 +1100] "GET /some/file.txt HTTP/1.1" 200 256 24 .Sh EXIT STATUS 25 .Ex 26 .Sh EXAMPLES 27 Print the most-requested paths 28 from the latest access log: 29 .Bd -literal -offset indent 30 hits /var/www/logs/access.log | sort -n | tail 31 .Ed 32 .Pp 33 Print the least-requested blog entries from 2021: 34 .Bd -literal -offset indent 35 grep 'blog/2021/' /var/www/logs/access.log | hits | sort -n | sed 10q 36 .Ed 37 .Pp 38 Print the 20 most-requested paths 39 from all access logs: 40 .Bd -literal -offset indent 41 cd /var/www/logs 42 gunzip -c access*.gz | cat access.log | hits | sort -nr | sed 20q 43 .Ed 44 .Sh SEE ALSO 45 .Xr awk 1