Apache does not record logs for specified format elements

Source: Internet
Author: User
Tags apache log file apache log

Apache log does not log the specified format element

Apache does not record the logs that point to the elements of the site, why this is required, and under what circumstances it is necessary to do so:

When calculating the log PV, generally do not need to statistics picture element of the log, because, open a Web page is a PV, when the RS server does not want to record

From the front end is responsible for balancing health checks of useless logs, the entire configuration requires MOD_SETENVIF module support, below our case

Case 1:apache does not record the picture log

A: Because the statistics log PV when a page is counted as a PV, and picture js,css and so on is just the elements of the picture, if recorded in the log, and then statistics PV is not accurate according to the log. So consider not recording log information such as pictures


<filesmastch "\. (css|js|gif|jpg|ico|swf) ">

SETENV IMAG 1

<\FilesMastch>


The actual log configuration

Customlog "| /application/apache/bin/rotatelogs/application/apache/logs/www.access_%y%m%d.log 86400 "Combined env=! IMAG


####################

Case 2:RS server does not log load Balancing health Check logs

The virtual host does not log load balancing down health check files

Setenvif request_url "^/check\.txt$" DontLog

Customlog "| /application/apache/bin/rotatelogs/application/apache/logs/www.access_%y%m%d.log 86400 "Combined Env=!dontlog


#################################################

Statistics Apache log file information

Awk-f ' [\]\\[\] ' {print $} ' Access.log |sort|uniq-c|sort-n

Awk-f ' [\]\\[\] ' {++s[$2]} END {for (key in S) print S[key],key} ' Access.log |sort-n


This article is from the "Technology Change Destiny" blog, please be sure to keep this source http://lvnian.blog.51cto.com/7155281/1697864

Apache does not record logs for specified format elements

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.