Apacheri Access log records

Source: Internet
Author: User
Tags log log apache log

Access logs do not log static files

Press F12 to locate the network by default

Refresh the Web page again
Each row is an element

To modify a virtual host configuration file
SETENVIF Environment env=!img

Verify

Images are displayed after uploading pictures

There's no PNG in the log.

Configure the expiration time for a static element

To modify a virtual host configuration file

Edit Master Profile Open expires module

See if the module is turned on

Verify

Remove module

Verify that there is no expiration time again

Agent IP and real client IP are recorded in Apache log
By default, the log log format is:
Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combined
Where%h is the IP of the record visitor, if there is a layer of proxy in the front of the web, then this%h is actually the IP of the proxy machine, this is not what we want. In this case,
The%{x-forwarded-for}i field records the client's true IP. So log logs should read:
Logformat "%h%{x-forwarded-for}i%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combined
Apache logs only the specified URI
My need is to www.aaa.com/aaa/a similar request ... The log is logged only for such requests.
Add in httpd.conf or the associated virtual host configuration file
Setenvif Request URI "^/aaa/.*" aaa-request
Customlog "|/usr/local/apache/bin/rotatelogs-l/usr/local/apache/logs/aaa-access
%y%m%d.log 86400 "Combined env=aaa-request
That's all you can do. This principle is the same as the log (http://www.lishiming.net/thread-561-1-1.html) that does not record static access such as images.

Apacheri Access log records

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.