Linux Utility log Analysis script log analysis random tail a access_log file, here is a classic access record218.19.140.242– - [Ten/dec/ .: the: to: -+0800] "get/query/trendxml/district/todayreturn/month/ the- A- -/ .- A- the/haizhu_tianhe.xml http/1.1″ $ 1933"-" "mozilla/5.0(Windows; U Windows NT5.1; ZH-CN; Rv:1.9.2.8) gecko/20100722firefox/3.6.8(. NET CLR3.5.30729"Useful log analysis script to understand the various definitions of the log, here to share some of the online from the log analysis of the script1. View the number of processes in Apache PS-aux | grep httpd | WC-L2. Analysis Log view the number of IP connections for the day catdefault-access_log | grep "Ten/dec/ .″| awk ' {print $2} ' | Sort | uniq-c | Sort-nr3. To see what the specified IP has visited on the day Urlcatdefault-access_log | grep "Ten/dec/ .″| grep "218.19.140.242″| awk ' {print $7} ' | Sort | uniq-c | Sort-nr4. View the top 10 Urlcat of today's visitdefault-access_log | grep "Ten/dec/ .″| awk ' {print $7} ' | Sort | uniq-c | Sort-nr | Head-nTen5. See what the specified IP has done. Catdefault-access_log | Grep218.19.140.242| awk ' {print1"'\ t "8} ' | Sort | uniq-c | Sort-nr | Less6. View the most visited minutes (find hotspots) awk ' {print $4}’default-access_log |cut-c -- -|sort|uniq-c|sort-nr|Head7. Statistics a text contains the number of characters cat Pic.access.log|grep/ -/|WC-Lcat C_access.log|grep"/message/publishmsg/\|/message/publish/">test1.log
This article is from the original link: http://www.cnblogs.com/liu-ke/p/4301827.html
Log analysis scripts common to Linux