that the resulting log is passed to Rotatelogs, which is the tool for Apache's own cut logs. The function of-L is to calibrate the timezone to UTC, Beijing time. The last side of 86400, the unit is the second, meaning a day. The combined for double cited is the log format, which defines the
Normal 0 0 2 false false en-US JA x-none MicrosoftInternetExplorer4
Apache , Tomcat Log Settings
I. Apache log overview
Apache contains two types of logs: error log, access log.
E
-l logs/access-% Y-% m-% d. log 86400 Prime; common This is simple. Just put it in. The error log is shown below.This section describes windows users. linux uses cronolog to separate apache logs.The cronolog tool can be run in linux or on a windows host. The installation method of linux is very simple. You can do it by using make install.
/apache/error-%y-%m-%d.log 86400" Logformat "%h%l%u%t \"%r\ "%>s%b" CommonCusto Mlog "|bin/rotatelogs.exe e:/log/apache/access.log" commonIf there are multiple sites, you need to set up for multiple sites, set in VirtualHostProxypreservehost on ServerAdmin admin ServerName www.yingbuluo.comProxypass/http://www.yingbuluo.com:8082/proxypassreverse/http://www.yingbu
The site's access log grows quickly, if saved in a file, do not cut, then quickly burst the server's disk, we need to cut it, and periodically delete useless logs, to ensure the proper use of the disk.1. Edit the virtual host configuration file[Email protected] important]# vim/usr/local/apache2/conf/extra/httpd-vhosts.conf2. Remove the comment in front of the access log configuration line #DocumentRoot "/tm
in httpd.conf search Logformat[[emailprotected] ~]# vim /usr/local/apache2.4/conf/httpd.confCombined and common two formats, by default using common format, referer the last visited URL. 3. The format of the change log is combined[[emailprotected] ~]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.confView
second, refers to the day. Then the log will be cut once every day. The last combined is the log format, in which the httpd.conf has the definition of the log format.# grep logformat/usr/local/apache2/conf/httpd.confLogformat "%h
Nginx:
Log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request "''$ Status $ body_bytes_sent "$ http_referer "''"$ Http_user_agent" $ request_time ';
Log format description:$ Remote_addr IP Address used for remote request$ Remote_user remote login name$ Time_local time, in common log time format (Standar
/apache_pb.gif HTTP/1.0" 200 2326
Examples of Apache log files in combined log format:
127.0.0.1-frank [10/Oct/2000: 13: 55: 36-0700] "GET/apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I; Nav )"
The IP address of the client.
The Apache runtime records information about all requests that it processes. In the meantime, information about the abnormal conditions that occurred during processing is also logged.The server can record the activity information related to the request in multiple log files in multiple formats, but only one copy of the error message is logged.With respect to the activity record, the
You can scroll the logs by the hour, using the PHP regular analysis log method to solve
$logLine = ' 127.0.0.1--[22/may/2015:17:09:13 +0800] ' get/sale/images/y-select.png http/1.1 ' 1095 '; $pattern = '/^ (? P
[0-9.] +) - - \[(? P
[^\]]+] \]+ "GET (? P
[^]+) http\/1.[ 1|0|2] "(? P
[0-9.] +) (? P
[0-9.] +)/I ';p reg_match ($pattern, $
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
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: Access logsAbout t
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 logf
Rotatelogs Gadgets with Apache
The syntax is as follows:
Rotatelogs [-l] logfile [rotationtime [offset]] | [Filesizem]
Parameter explanation:
-L: Use local time instead of GMT time as a time benchmark. Note: using-l in an environment that changes the GMT offset (such as daylight saving time) can lead to unpredictable results.LogFile: It plus the reference name is the log file name. If logfile contains "
1. Self-rotatelogs log cuttingRotatelogs Log Polling Instructions___________________________________________________________GrammarRotatelogs [-l] logfile [rotationtime [offset]] | [Filesizem]Options-L uses local time instead of GMT time as the time base. Note: In an environment that changes the GMT offset (such as daylight saving time)Using-L can cause unpredictable results.LogFile it plus the reference na
Linux: |/usr/local/sbin/cronolog/web/apache/logs/%y%m%daccess_log## The following directives define some format nicknames for use with# a customlog directive (see below).#Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ ""Logformat "%h%l%u%t \"%r\ "%>s%b" Common# need to enable MOD_LOGIO.C to Use%I And%OLogformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "%I%O" Combinedio##
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.