Goaccess is an open-source website log real-time analysis tool. The way goaccess works is easy to understand, reading and parsing apache/nginx/lighttpd access log files, and then displaying the statistics in a more friendly way. Statistics include: Access profile, dynamic page requests, static page requests (slices, style sheets, scripts, etc.), visitor rankings,
ip_count_first=[] #仅出现一次的IP + Time collection ip_count_many=[] #出现多次 ip first time Second time collection print ("Welcome to NGINX log analysis Gadget!!!!") ") Print (" function one: Count the number of times per IP access ")" "" Withopen ("Newlog.txt", "R") asngfile: forlineinngfile:iptime=line.split (' ') [0] ip=iptime.split ('-') [0]time =iptime.split (' [') [1]print (Ip,time) "" "Withopen (" Nginxlo
When the server pressure is larger, running very laborious time. We often do Site page optimization, will go to find those pages are more frequent, and more time-consuming. Find the addresses that are high and time-consuming, and the related optimizations will get immediate results. Here is a piece of shell script that I use frequently when I do optimization. This can be counted as a Web page slowpage slow access page, like the MySQL slowquery.
Here is my:
must be backed up and separated.Code(RHEL 5 ):
Logbackup. Sh -- compress the logs of the previous two days, back up the logs of the previous day, and restart nginx. I use corn to execute the logs at every day. Logs_path = "/var/www/nginxlog /"Date_dir =$ {logs_path} $ (date-d "-1 day" + "% Y")/$ (date-d "-1 day" + "% m ") /$ (date-d "-1 day" + "% d ")/Gzip_date_dir =$ {logs_path} $ (date-d "-2 day" + "% Y")/$ (date-d "-2 day" + "% m ") /$ (date-d "-
The current Zabbix monitor 900 or so servers, about 110,000 Items,zabbix in the work of the agent according to the working characteristics of the active mode and passive mode, in fact, generally open compatibility mode. After more items, there are some slow items if you do not adopt the active mode, will drag the server end, and Zabbix_sender is actually a disguised active mode, with the scheduled task, the initiative will k/v upload to Zabbix, now will ngin
The interview will be quilt cover to the problem is: to give the Web server access logs, please write a script to statistics access to the top 10 of the IP? What are the top 10 requests for access? When you have a taste of goaccess, you understand that these problems, in addition to testing your script memorization ability, the only role is to install a or C.For nginx log analysis, there are many tools to m
Professional statistics website, such as Baidu Statistics, Google ANALYTICS,CNZZ and other statistical background to provide the webmaster commonly used statistical indicators, such as UV,PV, online time, IP, etc., in addition, because of network reasons, I found that Google Analytics will be more than Baidu statistics more than hundreds of of the IP, so want to write their own feet to understand the actual number of visits, but the access log based o
Deploy Nginx, look at the Nginx log, found that the value of Request_body is not recordedNginx log:192.168.1.1--2016-02-24t13:33:54+08:00post/rate_plan http/1.12002----0.0020.701192.168.1.1--2016-02-24t13:33:54+08:00post /rate_plan http/1.12002----0.0010.617192.168.1.1--2016-02-24t13:37:44+08:00post /rate_plan http/1.1
Nginx does not log unwanted access logsNginx does not record the log pointing to the elements of the site, why do you need to do so, under what circumstances need to do this:When calculating the log PV, generally do not need to statistics picture element of the log, because,
Because Nginx is not like Apache, has its own cutting log tool. So you need a script to do it.Vim/usr/local/sbin/nginx_logrotate.sh #定义脚本名称#!/bin/bashd= ' date-d '-1 day "+%f ' #定义时间变量, i.e. yesterday's time[-d/tmp/nginx_log] | | Mkdir/tmp/nginx_log #首先判断是否存在目录, does not exist create directorymv/tmp/access.log/tmp/nginx_log/$d. Log #移动日志到指定目录/etc/init.d/
Configure the log loop directly in the Nginx configuration file without using Logrotate or configuring cron tasks. You need to use the $time_iso8601 inline variable to get the time. $time _iso8601 format is as follows: 2015-08-07t18:12:02+02:00. The regular expression is then used to get the data for the desired time.split log by dayUse the following code block
configuration file Location ~. php$ { root html; Fastcgi_pass 127.0.0.1:9000; Fastcgi_index index. php; Fastcgi_param $document _root$fastcgi_script_name# Newinclude # New}3. Hide the entry fileA. If the code is in the root directory that the domain name points to, then// ... omit part of the code if $request _filename ) { rewrite ^ (. *) $ /index.php?s=$1 last ; Break ; }}B. If the code is under a subordinate directory th
When using Nginx as a reverse proxy, the client IP for Tomcat logging is not the real client IP, but the IP of the Nginx agent. To solve this problem, you can configure a new header in Nginx to store the $remote_add, and then Tomcat gets the record of this value.
1.Nginx New configuration:
Proxy_set_header X-real
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.