Linux System Web log analysis this aspectMore tools, such as Logwatch or awstats, are developed using Perl and are very powerful. But these software need to do someConfiguration, many friends often do not invest too much power in technology, even if reference to the Internet textThe tutorial also does not do. In this case I wrote a Web log analysis script, the function is relatively simple, no configuration, the need for friends can try again.
Script Address:
GBK version (General SSH client does not have to be adjusted directly available:
wget http://jinxiang.oss-cn-hangzhou.aliyuncs.com/weblogcheckgbk.sh
Version UTF8 (if you use this in garbled characters):
wget http://jinxiang.oss-cn-hangzhou.aliyuncs.com/weblogcheckutf8.sh
How to use the script:
./weblogcheckgbk.sh [-c n] [-t n]-F FILE
Option Description:
-C (optional): Set the IP, resource top table display, the default display of the top 5, the parameters need to fill in the whole number
-T (optional): Set the log statistics period, the default statistics last 6 times, the parameters need to fill in the integer
-F (Required): Specifies the log file, if the script is not in the same directory as the log file, the absolute path must be filled
Cases:
./weblogcheckgbk.sh-f/alidata/log/httpd/access/phpwind.log
./weblogcheckgbk.sh-c 3-t 3-f/alidata/log/httpd/access/phpwind.log
Note:
The script can be counted Apache or Nginx log, but need to be common format, currently we provide the user's one-click installation package and Yum mode installation, the log is this format, other custom log format may not run properly.
Operation demo, with Nginx access log as an example:
1, download the script, increase permissions, query the Web Access log location
2. Execute Script Analysis Log
Linux System Web log Analysis script