1. View Apache process:
PS aux | grep httpd | Grep-v grep | Wc-l
2, view the TCP connection for port 80:
Netstat-tan | grep "established" | grep ": 80" | Wc-l
3, through the log to view the number of IP connections today, filtering duplicates:
Cat Access_log | grep "20/oct/2008" | awk ' {print $} ' | Sort | uniq-c | Sort-nr
4, what is the highest IP connection IP in the day (originally a spider):
Cat Access_log | grep "20/oct/2008:00" | grep "122.102.7.212" | awk ' {print $8} ' | Sort | uniq-c | Sort-nr | Head-n 10
5, the first page of the day to access the top 10 URL:
Cat Access_log | grep "20/oct/2008:00" | awk ' {print $8} ' | Sort | uniq-c | Sort-nr | Head-n 10
6, Sniff with tcpdump 80 port to see who's highest
Tcpdump-i ETH0-TNN DST Port 80-c 1000 | Awk-f "." ' {print $ '. $ "." $ "." $4} ' | Sort | uniq-c | Sort-nr
<pre>
Then check the log to see what the IP is doing:
<pre lang= "PHP" >
Cat Access_log | grep 122.102.7.212| awk ' {print ' \ t ' $8} ' | Sort | uniq-c | Sort-nr | Less
7. View the number of IP connections for a time period:
grep "2006:0[7-8]" Www20060723.log | awk ' {print $} ' | Sort | uniq-c| Sort-nr | Wc-l
==============================nginx
Log_format main ' [$time _local] $remote _addr $status $request _time $body _bytes_sent "$request" "$http _referer";
Access_log/data0/logs/access.log main;
The format is as follows:
[21/mar/2011:11:52:15 +0800] 58.60.188.61 0.265 "Post/event/time http/1.1" "Http://host/loupan/207846/feature"
View the number of IP connections in the day by log, filter duplicate
Cat Access.log | grep "20/mar/2011" | awk ' {print $} ' | Sort | uniq-c | Sort-nr
38 112.97.192.16
20 117.136.31.145
19 112.97.192.31
3 61.156.31.20
2 209.213.40.6
1 222.76.85.28
The URL for the first 10 of the day's access page:
Cat Access.log | grep "20/mar/2011" | awk ' {print $8} ' | Sort | uniq-c | Sort-nr | Head-n 10
Find the 10 most visited IPs
awk ' {print $} ' Access.log |sort |uniq-c|sort-nr|head
10680 10.0.21.17
1702 10.0.20.167
823 10.0.20.51
504 10.0.20.255
215 58.60.188.61
192 183.17.161.216
38 112.97.192.16
20 117.136.31.145
19 112.97.192.31
6 113.106.88.10
Find the 10 most visited IPs of the day
Cat/tmp/access.log | grep "20/mar/2011" |awk ' {print $} ' |sort |uniq-c|sort-nr|head
38 112.97.192.16
20 117.136.31.145
19 112.97.192.31
3 61.156.31.20
2 209.213.40.6
1 222.76.85.28
What IP connections with the highest number of IPs are doing today:
Cat Access.log | grep "10.0.21.17" | awk ' {print $8} ' | Sort | uniq-c | Sort-nr | Head-n 10
224/test/themes/default/img/logo_index.gif
224/test/themes/default/img/bg_index_head.jpg
224/test/themes/default/img/bg_index.gif
219/test/vc.php
219/
213/misc/js/global.js
211/misc/jsext/popup.ext.js
211/misc/js/common.js
210/sladmin/home
197/misc/js/flib.js
Find the most visited few minutes
awk ' {print '} ' Access.log | grep "20/mar/2011" |cut-c 14-18|sort|uniq-c|sort-nr|head
24 16:49
19 16:17
16 16:51
11 16:48
4 16:50
3 16:52
1 20:09
1 20:05
1 20:03
1 19:55
Nginx/apache Log Parsing scripts