Linux sort uniq awk head completes the access log statistics sorting function, uniqawk
We often collect some access logs during development. The URLs in the access logs are massive and many of them are duplicated. Take the url as an example. Count the top 5 URLs that appear frequently in the url and sort them in descen
? Php * Program: access log statistics author: abandon thinking (QQ: 376123224) date: *###################################### ########## function ############ functionFormat2UnixTime ($ str) {* This function is a format conversion function that converts a format conversion function from: $ str03Mar2005: 16: 53: 32
/*
P
Description
Operating system: CentOS
Site 1:bbs. 111cn.net
Site 2:sns. 111cn.net
Nginx Installation path:/usr/local/nginx
Nginx configuration file path:/usr/local/nginx/conf/nginx.conf
Site 1 configuration file path:/usr/local/nginx/conf/vhost/bbs.111cn.net.conf
Site 2 configuration file path:/usr/local/nginx/conf/vhost/sns.111cn.net.conf
Objective:
1, the site 1 and site 2 of the Nginx access log
When we develop, we often count some access logs, the URLs in the access log are huge, and many are duplicates. In the URL, for example, the URL appears in the first 5 frequency of the number of URLs, and the number of occurrences in descending order.Linux commands:cat url.log | sort | uniq-c |sort-n-r-k 1-t ' | awk-f '//' {print $} 'Now let's analyze the meaning
1. Access LogsIn the previous virtual host configuration file, there are two lines of log-related configuration, and the end of combined is the format type of the logErrorlog "Logs/111.com-error_log" Customlog "Logs/111.com-access_log" combinedThe following log formats are defined in the master configuration file for A
Configure Apache access logs and log cuts1. Open the Apache master configuration file, command:vim/usr/local/apache2/conf/httpd.conf, locate the Log_config_module module, You can see two logformat(log format) as shown in:650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/8E/5F/wKioL1i-xNOTigYyAAAdvEazfcE062.pn
? Php/* Program: access log statistics author: give up thinking (QQ: 376123224) date: 2005-7-22 */##################################### ########### function ############ functionFormat2UnixTime ($ str) {/* This function is a format conversion function, which will be similar
/*Program: access
1. Introduction to the LogThere are two main types of Nginx logs: Access logs and error logs. The access log mainly records each request that the client accesses Nginx, the format can be customized; the error log mainly records the log
Turn from: http://goon.iteye.com/blog/1814609
This article describes how to configure a Tomcat access log to output the specified log format as we request.and in the Nginx+tomcat configuration environment, how to let Tomcat record the true IP address of the visitor。 This article for the original content, reproduced ple
1. Define the log format in the master configuration file[Email protected] ~]# vim/usr/local/apache2/conf/httpd.conf# Default defined log format, combined is the log format name logformat "%h%l%u%t \"%r\ "%>s%b" common
Log formatvim/usr/local/nginx/conf/nginx.conf//Search Log_format
$remote _addr
Client IP (public IP)
$http _x_forwarded_for
IP of the proxy server
$time _local
Server local time
$host
Access host name (domain name)
$request _uri
URL address of the access
Apache, the browser access www.abc.com will jump directly to www.123.com.If you want to test the effect quickly, you can actually use the Curl command directly on the Linux command line.#curl-x127.0.0.1:80 Www.123.com/bbs/forum.php-Ihttp/1.1 301 Moved Permanentlyserver:nginx/1.0.15Connection:keep-aliveDate:thu, 14:12:56 GMTContent-type:text/htmlcontent-length:185location:http://www.123.com/bbs/forum.phpx-upstream-echo-time:53Three:
In this two-week group, we wanted to learn python, so we created an environment and atmosphere for everyone to learn.
Yesterday in the group, posted a demand, is to count squid access log IP access number and URL of the number of visits and sorting, many students have generally achieved the corresponding functions, I put my simple implementation of the post, wel
/apachectl -M |grep rewrite rewrite_module (shared)[[emailprotected] ~]# /usr/local/apache2.4/bin/apachectl graceful3. Test whether the jump was successful80 ports with a few colons is the start of several network cardscurl-x192.168.122.1:80 Www.example.com-I//-i can view results directly[[emailprotected] ~]# curl -x192.168.122.1:80 www.example.com -IHTTP/1.1 301 Moved PermanentlyDate: Wed, 07 Mar 2018 13:43:47 GMTServer: Apache/2.4.29 (Unix) PHP/7.1.6Location: http://www.xavi.com/Content-Type:
host user access authentication mechanism:
Edit virtualhost.conf:
ServerName www.izyno.comDocumentRoot "/www/izyno.com"Options NoneAllowOverride authconfig #允许使用与认证授权相关的指令, they include Authdbmgroupfile authdbmuserfile authgroupfile authname Authtypeauthuserfile and requireAuthType BasicAuthName "My Site."AuthUserFile "/ETC/HTTPD/.HTPASSWD" #指定用户认证文件, you need to use htpasswd generation.Require Valid-user #定义为所有认证用户可以访问
Build users with HTPA
This document describes how to configure tomcat access logs and output the specified log format as required.
In addition, in the Nginx + Tomcat configuration environment, how can Tomcat record the real IP addresses of visitors?. This article is original content. For more information, see JDiy official website.
Http://jdiy.net/read.jsp? Id = y0hab3qs03 in tomcat
(1) Access_log is a Configuration item for the Ngx_http_log_module module. Syntax:access_log path [format [buffer=size] [gzip[=level] [flush=time] [if=condition]];Access_log off;Default:Access_log Logs/access.log combined;Context:http, server, location, if on location, limit_exceptNginx access_log and log_format configuration items:Log_format is used to define the log
Tags: RKE send remote App pes add size format remoteNginx access logs are controlled by two main parametersLog_format #用来定义记录日志的格式 (can define a variety of log formats, take different names can be)Access_log #用来指定日至文件的路径及使用的何种日志格式记录日志Default value for Lof_format:# log_format main '$remote_addr - $remote_user [$time_local] "$request" '# '
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.