Log analysis scripts common to Linux

Source: Internet
Author: User

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

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.