Apache, tomcat log settings

Source: Internet
Author: User
Tags apache log

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.

Error log: Storage of diagnostic information and processing of errors in the request, often containing the details of the error and how to troubleshoot, server startup or running problems, you should first view this log.

Access log: Logs all requests processed by the server. ii. The method of the Apache log content recording

Official description Reference for the log: http://httpd.apache.org/docs/2.2/ja/logs.html 1. access log ① use combined to get more detailed logs

Configuration:

Edit httpd.conf File

Customlog
Customlog Logs/access_log combined

The format is not lost, and additional information is available (Referer and user-agent).

Adaptation situation:

Server exceptions caused by a particular request can be helpful. ② custom Log format

Configuration:

Detailed content: http://httpd.apache.org/docs/2.2/ja/mod/mod_log_config.html

Adaptation situation:

Server exceptions caused by a particular request can be helpful. ③ use mod_security to record POST-delivered data

Configuration:

Http://www.modsecurity.org/documentation/index.html

Adaptation situation:

Enhance the security of Apache. ④ multiple file access log

Configuration:

Logformat "%h%l%u%t/"%r/"%>s%b" common
Customlog Logs/access_log Common
Customlog Logs/referer_log "%{referer}i->%u"
Customlog Logs/agent_log "%{user-agent}i"

Adaptation situation:

Logs different log information to different files, easy to find their own interest in the log. ⑤ Condition Log

Configuration:

# don't record requests from machines
Setenvif remote_addr "127/.0/.0/.1" DontLog
# Requests for robots.txt files are not logged
Setenvif Request_uri "^/robots/.txt$" DontLog
# Record Other requests
Customlog Logs/access_log Common Env=!dontlog

Adaptation situation:

Get the log content that interests you. ⑥ other log files

Configuration:

module

directive

effect

adaptation

Mod_logio

Logformat strong>

Record actual bytes received and sent

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.