Accesslog or cookie 'Log shell common analysis script [java] # Count the 20 most frequently accessed ip addresses and times in apache cookie log cat cookielog | awk' {a [$1] + = 1 ;} END {for (I in a) printf ("% d, % s \ n", a [I], I );} '| sort-n | tail-20 # Calculate the url list awk returned from the apache cookie log 404' $11 = 404 {print $8} 'access_log | uniq-c | sort -rn | head # Count the list of ip addresses and access times that an ip address has accessed more than 20 times, if you change $1 to $9 corresponding to the url, you can calculate the number of visits to each url cat access_log | awk '{print $1}' | sort | uniq-c | sort -N | awk '{if ($1> 20) print $1, $2} '# calculate the average access time of each url cat cookielog | awk' {a [$6] + = 1; B [$6] + = $11 ;} END {for (I in a) printf ("% d, % d, % s \ n", a [I], a [I]/B [I] I);} '| sort-n | tail-20 # print the new ip address list for accessing apache tail-f access. log | awk-W interactive '! X [$1] ++ {print $1} '# view the URLs and access times of the specified ip address on the current day through the log: cat access. log | grep "10.0.21.17" | awk '{print $7}' | sort | uniq-c | sort-nr # awk '{print $ 4} 'access. log | grep "26/Mar/2012" | cut-c 20-50 | sort | uniq-c | sort-nr | head # view the access volume of a day cat access_log | grep '12/ nov/100' | grep "******. htm "| wc | awk '{print $1}' | uniq # view the url list for more than 30 ms of access time cat access_log | awk '($ NF> 30) {print $7} '| sort-n | un Iq-c | sort-nr | head-20 # list URLs whose response time exceeds 60 MB and count the number of occurrences cat access_log | awk '($ NF> 60 & $7 ~ /\. Php /) {print $7} '| sort-n | uniq-c | sort-nr | head-100 # exclude the number of url accesses after the search engine sed "/Baiduspider/d; /Googlebot/d;/Sogou web spider/d; "xxx. log | awk-F ''' {print $7} '| sort | uniq-c | sort-k1, 2-nr # uv grep "/index.html" access to the statistics/index.html page. log | cut-d ""-f 4 | sort | uniq | wc-l