Log analysis in general is beyond the scope of this document, and not really part of the job of the web server itself. For more information about this topic, and for applications which perform log analysis, check the Open Directory.
The CustomLog directive now subsumes the functionality of all the older directives. The format of the access log is highly configurable. The format is specified using a format string that looks much like a C-style printf 1 format string. Some examples are presented in the next sections. This defines the nickname common and associates it with a particular log format string.
The format string consists of percent directives, each of which tell the server to log a particular piece of information. Literal characters may also be placed in the format string and will be copied directly into the log output. The quote character " must be escaped by placing a backslash before it to prevent it from being interpreted as the end of the format string. The CustomLog directive sets up a new log file using the defined nickname. The filename for the access log is relative to the ServerRoot unless it begins with a slash.
This standard format can be produced by many different web servers and read by many log analysis programs. The log file entries produced in CLF will look something like this:. Another commonly used format string is called the Combined Log Format. It can be used as follows. This format is exactly the same as the Common Log Format, with the addition of two more fields.
The access log under this format will look like:. Multiple access logs can be created simply by specifying multiple CustomLog directives in the configuration file.
For example, the following directives will create three access logs. The first contains the basic CLF information, while the second and third contain referer and browser information. This example also shows that it is not necessary to define a nickname with the LogFormat directive. Instead, the log format can be specified directly in the CustomLog directive. There are times when it is convenient to exclude certain entries from the access logs based on characteristics of the client request.
This is easily accomplished with the help of environment variables. First, an environment variable must be set to indicate that the request meets certain conditions. This is usually accomplished with SetEnvIf. Some examples:. As another example, consider logging requests from english-speakers to one log file, and non-english speakers to a different log file.
In a caching scenario one would want to know about the efficiency of the cache. A very simple method to find this out would be:. In that case a cache hit will log - , while a cache miss will log 1. In other cases, a literal "-" will be logged instead. Likewise, in the second example, the Referer will be logged if the HTTP status code is not , , or The following modules add or change the logging behavior in useful ways. This is the base logging module that Apache uses, and the one that we covered in this section of the guide.
This module provides additional options for logging debug messages. For example, you can log events to a specific URL path, log requests after they are processed, log messages from a specific client if they result in timeouts, and more. Note that this module is experimental and may not be included in your Apache distribution.
For example, the following configuration logs the IP address of a client whenever it requests a specific path:. This module enables logging before and after a request is processed. Each entry is assigned a unique ID, which can be used to trace events between the forensic log and normal log.
However, the forensic logger does not support custom formats. Once the module is enabled, you can use the forensic keyword to specify which log file is the forensic log. This module adds the ability to log the number of bytes sent and received per request.
This includes bytes received, sent, and transferred combination of received and sent. TTFB is the amount of time from when a request is received to when the response is first sent to the client.
This module provides context-sensitive filters to the output chain by registering any number of filter providers. The context containers include: main apache config, vhost config, within directory tags, and.
This module is provided by default in many of the package distributions, but may require enabling. For the purposes of logging, the FilterTrace directive posts information to the error log. Directives include:. The following example applies filtering in a vhost context container conditionally on filter and include modules:.
This module constructs an environment variable and a unique identifier for each request. This unique identifier is written to the access log. This allows application developers to trace a request through the web server to the application server. It can be useful for debugging a request. Apache spins off child processes to handle requests, and a child instance processes several requests at a time.
Ask Question. Asked 9 years, 5 months ago. Active 1 year, 6 months ago. Viewed k times. Improve this question. Gilles 'SO- stop being evil' k gold badges silver badges bronze badges. AkshaiShah AkshaiShah 3, 5 5 gold badges 16 16 silver badges 9 9 bronze badges. On what distribution, or with what hosting provider?
Add a comment. Active Oldest Votes. Improve this answer. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Learn more. Where are the Apache and PHP log files? Ask Question. Asked 10 years, 11 months ago. Active 18 days ago. Viewed k times. Improve this question. Stann Stann Add a comment.
0コメント