The IP that lists the most visited times of the day
command:
Copy Code code as follows:
Cut-d--F 1/usr/local/apache2/logs/access_log |uniq-c | Sort-rn | Head-20
Principle:
Copy Code code as follows:
cut
-D,--delimiter=delim
Use Delim instead's TAB for field delimiter
&nb sp; represented by-split, then-F 1
F,--fields=list
; Select only this fields; also print any contains No
delimiter character, unless the-s option is specified
means print first part , that is, the IP
uniq is the duplicate row is removed,-c means the front plus number,
sort-rn is sorted by number from large to small,
&nbs p; head-20 Take the front 20 lines
The last printed result is probably this:
Copy Code code as follows:
217 192.114.71.13
116 124.90.132.65
108 192.114.71.13
102 194.19.140.96
101 217.70.34.173
100 219.235.240.36
The following are shell usages of some of the other analysis logs:
1, see how many IP access on the day:
Copy Code code as follows:
awk ' {print $} ' log_file|sort|uniq|wc-l
2. View the number of times a page has been visited;
Copy Code code as follows:
grep "/index.php" Log_file | Wc-l
3, see how many pages per IP access:
Copy Code code as follows:
awk ' {++s[$1]} end {for (a in S) print A,s[a]} ' log_file
4, each IP access to the number of pages from small to large sort:
Copy Code code as follows:
awk ' {++s[$1]} end {for (a in S) print S[a],a} ' log_file | Sort-n
5, look at an IP access to which pages:
Copy Code code as follows:
grep ^111.111.111.111 log_file| awk ' {print $1,$7} '
6, remove the search engine statistics on the day of the page:
Copy Code code as follows:
awk ' {print $12,$1} ' log_file | grep ^\ "Mozilla | awk ' {print $} ' |sort | Uniq | Wc-l
7, view June 21, 2009 14 o'clock in the one hours of the number of IP access:
Copy Code code as follows:
awk ' {print $4,$1} ' log_file | grep 21/jun/2009:14 | awk ' {print $} ' | Sort | Uniq | Wc-l