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. 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:
/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
First, configuration and description
Tomcat access log format configuration, under the host tag in Config/server.xml Plus
prefix= "Localhost_access_log" suffix= ". txt"pattern= "%h%l%u%t quot;%rquot; [%{postdata}r]%s%{referer}i%{user-agent}i%T%b "/>
We will see the following text in the log file:
10.217.14.16--[21/oct/
When we were learning about Apache, we had access to the log, remember where the log format is defined, and in HTTPD's main configuration file,/usr/lcoal/apache2.4/conf/httpd.confSearch Logformat can see, the system gave us two formats, combined and common we chose to use the combined, it recorded more comprehensive in
Python analysis of the access log script sharing by the ngnnx, pythonnignx
#! /Usr/bin/env python # coding = UTF-8 # ---------------------------------------------------- # Name: nginx log analysis script # Purpose: This script is only used to analyze nginx access logs # Version: 1.0 # Hor: LEO # Created: 2013-05-07 # M
, delete rewrite_module (shared) in front of the #2. TestCurl-x127.0.0.1:80-i 123.com-i//Status code is 301Third, Apache access log1. Access logging records every request from a user2. Define the format for the logvim/usr/local/apache/conf/httpd.conf//Search for Logformat, it gives you two formats:Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\
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
This suggestion comes from Joshua Bloch's "Provide Programmatic Access to All Data Available in String Form ". I wrote this short article based on his outline.
This suggestion means that if you write a module, the data information that can be disclosed in the module should be provided to the customer in String format. If you do not provide such a String access in
This article describes how to use the python script to calculate the ip address access times in log files. Note that this script only applies to log files whose ip addresses start with each line. For more information, see
Applicable log formats:
106.45.185.214 - - [06/Aug/2014:07:38:59 +0800] "GET / HTTP/1.0" 200 10
(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
%a-remote IP Address
%a-local IP Address
%b-bytes sent, excluding HTTP headers, or '-' if no Bytes were sent
%b-bytes sent, excluding HTTP headers
%h-remote host name (or IP address if enablelookups for the connector is false)
%h-request protocol
%l-remote logical username from Identd (always returns '-')
%m-request method
%p-local Port
%q-query string (prepended with a ' "if it exists, otherwise an empty string
%r-first Line of the request
%s-http status Code of the respon
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.