Accesslog or cookie 'log shell common analysis scripts

Source: Internet
Author: User
Accesslog or cookie & amp; #39; log shell common analysis script [java] # count the 20 most frequently accessed ip addresses and times in apachecookielog. catcookielog | awk & amp; #39; {a [$1] + 1;} END {for (iina) printf (& quot; % d ,... 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 404 returned in the apache cookie log' $11 = 404 {print $8 }' Access_log | uniq-c | sort-rn | head # calculates the list of ip addresses and access times that an ip address has accessed more than 20 times, and changes $1 to $9 corresponding to the url, you can count 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.