2.1-apache log of specified file types is not logged

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

In the Apache access log, all actions are logged by default. Includes some local static small pictures, so the log becomes bloated.

At this point we can specify that the log of the specified file type is not logged, so that only the log we want is logged.

Configuration steps:

1: Mark specified file type

<virtualhost *:80>

ServerAdmin [email protected]

DocumentRoot "/usr/local/src/discuz"

ServerName www.llzdwyp.com

Serveralias www.wyp.com

Serveralias www.hdnet.com

<ifmodule mod_rewrite.c>

Rewriteengine on

Rewritecond%{http_host} ^www.wyp.com$ [OR]

Rewritecond%{http_host} ^www.hdnet.com$

Rewriterule ^/(. *) $ http://www.llzdwyp.com/$1 [r=301,l]

</IfModule>

setenvif Request_uri ". *\.gif$" Image-request

Setenvif Request_uri ". *\.jpg$" Image-request

Setenvif Request_uri ". *\.bmp$" Image-request

Setenvif Request_uri ". *\.swf$" Image-request

Setenvif Request_uri ". *\.css$" Image-request

Setenvif Request_uri ". *\.js$" Image-request

Setenvif Request_uri ". *\.png$" Image-request

errorlog "Logs/dummy-host.example.com-error_log"

Customlog "|/usr/local/apache2/bin/rotatelogs-l/usr/local/apache2/logs/%y%m%d-access_log 86400" combined


Where Requiest_uri represents 192.168.11.201 in the log record--[22/aug/2015:00:28:38 +0800] "get/static/image/common/pt_item.png http/1.1 "301 262" http://www.llzdwyp.com/forum.php "" mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; trident/6.0; SLCC2;. NET CLR 2.0.50727;. NET CLR 3.5.30729;. NET CLR 3.0.30729;. net4.0c;. NET4.0E) "

get this action after the domain name sub-address

". *\.gif$" represents the end of a. gif

Image-request Representative Mark


2: Tag Processing

Customlog "|/usr/local/apache2/bin/rotatelogs-l/usr/local/apache2/logs/%y%m%d-access_log 86400" combined env=! Image-request

That is, env is not equal to the tag image-request the log that does not record the tag


2.1-apache log of specified file types is not logged

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.