Apache error log referer

apache error log referer

Access and Error Logs. Log Files. An Apache log is a record of the events that have occurred on your Apache web server. Apache stores two kinds of logs. referrer is voluntarily sent in HTTP headers from the client/browser to the server, so the server logs can be. Few deprecated directories are RefererLog, CookieLog, RefererIgnore, and AgentLog. Error Log. The information on errors encountered by the. apache error log referer Accept-Language:en-US,en;q=0.8 User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36  ja  Cache-Control:max-age=0

Apache Module mod_log_config


This module provides for flexible logging of client requests. Logs are written in a customizable format, apache error log referer, and may be written directly to a file, or to an external program. Conditional logging is provided so that individual requests may apache error log referer included or excluded from the logs based on characteristics of the request.

Three directives are provided by this apache error log referer to create a log file, to set a custom format, and to define a log file and format in one step. The and directives can be used multiple times in each server to cause each request to be logged to multiple files.



See also


Custom Log Formats

The format argument to the and directives is a string. This string is used to log each request to the log file. It can contain literal characters copied into the log files and the C-style control characters "\n" and "\t" to represent new-lines and tabs. Literal quotes and backslashes should be escaped with backslashes.

The characteristics of the request itself are logged by placing "" directives in the format string, which are replaced in the log file by the values as follows:

The percent sign.
Client IP address of the request (see the module).
Underlying peer IP address of the connection (see the module).
Local IP-address.
Size of response in bytes, excluding HTTP headers.
Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '' rather than a 0 when no bytes are sent.
The contents of cookie in the request sent to the server. Only version 0 cookies are fully supported.
The time taken to serve the request, in microseconds.
The contents of the environment variable .
Remote hostname. Will log the IP address if is set to which is the default. If it logs the hostname for only a few hosts, apache error log referer, you probably have access control directives mentioning them by name. See the Require host documentation.
The request protocol.
The contents of header line(s) in the request sent to the server. Changes made by other modules (e.g. ) affect this. If you're interested in what the request header was prior to when most modules would have modified it, use reservation map error to copy the header into an internal environment variable and log that value with the described chronoform error back above.
Number of keepalive requests handled on this connection. Interesting if is being used, so that, for example, a '1' means the first keepalive request after the initial one, '2' the second, etc.; otherwise this is always 0 (indicating the initial request).
Remote logname (from identd, if supplied). This will return a dash unless is present and is set .
The request log ID from the error log (or '-' if nothing apache error log referer been logged to the error log for this request), apache error log referer. Look for the matching error log line to see what request caused what error.
The request method.
The contents of note from another module.
The contents of header line(s) in the reply.
The canonical port of the server serving the request.
The canonical port of the server serving the request, or the server's actual port, or the client's apache error log referer port. Valid formats are, apache error log referer, orapache error log referer.
The process ID of the child that serviced the request.
The process ID or thread ID of the child that serviced the request. Valid formats are, bios error disable 14424 and. requires APR 1.2.0 or higher.
The query string (prepended with a if a query string exists, otherwise an empty string).
First line of request.
The handler generating the response (if any).
Status. For requests that have been internally redirected, this is the status of the original request, apache error log referer. Use for the final status.
Time the request was received, in the format. The last number indicates the timezone offset from GMT
The time, in the form given by format, which should be in an extended format (potentially localized). If the format starts with (default) the time is taken at the beginning of the request processing. If it starts with it is the time when the log entry gets written, close to the end of the request processing. In addition to the formats supported bythe following format tokens are supported:
number of seconds since the Epoch
number of milliseconds since the Epoch
number of microseconds since the Epoch
millisecond fraction
microsecond fraction
These tokens can not be combined with each other or formatting in the same format string. You can use multiple tokens instead.
The time taken to serve the request, in seconds.
The time taken to serve the request, in a time unit given by . Valid units are for milliseconds, for microseconds, and for seconds, apache error log referer. Using gives the same result as without any format; using gives the same result as. Combining with a unit is available in 2.4.13 and later.
Remote user if the request was authenticated. May be bogus if return status () is 401 (unauthorized).
The URL path requested, not including any query string.
The canonical of the server serving the request.
The server name according to the setting.
Connection status when response is completed:
=Connection aborted before the response completed.
=Connection may be kept alive after the response is sent.
= Connection will be closed after the response is sent.
Bytes received, including request and headers. Cannot be zero. You need to enable to use this.
Bytes sent, including headers. May be zero in rare cases such as when a request is aborted before a response is sent. You need to enable to use this.
Bytes transferred (received and sent), including request and headers, cannot be zero, apache error log referer. This is the combination of %I and %O. You need to enable to use this.
The contents of trailer line(s) in the request sent to the server.
The contents of trailer line(s) in the response sent from the server.


Particular items can be restricted to print only for responses with specific HTTP status codes by placing a comma-separated list of status codes immediately following the "%". The status code list may be preceded by a "" apache error log referer indicate negation.

Logs on 400 errors and 501 errors only. For other status codes, apache error log referer, the literal string will be logged.
Logs on all requests that do not return one of the three specified codes, "" otherwise.

The modifiers "<" and ">" can be used for requests that have been internally redirected to choose whether the original or final (respectively) request should be consulted. By default, the directives and look at the original request while all others look at the final request. So for example, can be used to record the final status of the request and can be used to record the original authenticated user on a request that is internally redirected to an unauthenticated resource.

Format Notes

For security reasons, starting with version 2.0.46, non-printable and other special characters in and are escaped using sequences, where stands for the hexadecimal representation of the raw byte. Exceptions from apache error log referer rule are and which are escaped by prepending a backslash, and all whitespace characters, which are written in their C-style notation (,etc). In versions prior to 2.0.46, apache error log referer, no escaping was performed on these strings so you had to be quite careful when dealing with raw log files.

Since httpd 2.0, unlike 1.3, apache error log referer, the and format strings do not represent the number of bytes sent to the client, but simply the size in bytes of the HTTP response (which will differ, for instance, if the connection is aborted, or if SSL is used). The format provided by will log the actual number of bytes sent over the network.

Note: is implemented as a quick-handler and not as a standard handler. Therefore, the format string will not return any handler information when content caching is involved.


Some commonly used log format strings are:

Common Log Format (CLF)
Common Log Format with Virtual Host
NCSA extended/combined log format
Referer log format
Agent (Browser) log format

You can use the directive multiple times to build up a time format using the extended format tokens like :

Timestamp including milliseconds

Security Considerations

See the security tips document for details on why your security could be compromised if the directory where logfiles are stored is writable by anyone other than the user that starts the server.



The directive causes to store several log entries in memory and write them together to disk, apache error log referer, rather than writing them after each request. On some systems, this may result in more efficient disk access and hence higher performance. It may be set only once for the entire server; it cannot be configured per virtual-host.

This directive should be used with caution as a crash might cause loss of logging data.



Description:Sets filename and format of log file
Context:server config, virtual host

The directive is used to log requests to the server. A log format is specified, and the logging can optionally be made conditional on request characteristics using environment variables.

The first argument, which specifies the location to which the logs will be written, can take one of the following two types of values:

A filename, relative to the .
The pipe character "", followed by the path run-time error 8007007e to a program to receive the log information on its standard input. See the notes on piped logs for more information.


If a program is used, then it will be run as the user who started. This will be root if the server was started by root; be sure that the program is secure.


When entering a file path on non-Unix platforms, care should be taken to make sure that only forward slashed are used even though the platform may allow the use of back slashes. In general it is a good idea to always use forward slashes throughout the configuration files.

The second argument specifies what will apache error log referer written to the log file. It can specify either a defined by a previous directive, or it can be an explicit string as described in the log formats section.

For example, the following two sets of directives have exactly the same effect:

# CustomLog with format nickname LogFormat "%h %l %u %t \"%r\" %>s %b" common CustomLog "logs/access_log" common # CustomLog with explicit format string CustomLog "logs/access_log" "%h %l %u %t \"%r\" %>s %b"

The third argument is optional and controls whether or not to log a particular request. The condition can be the presence or absence (in the case of a '' clause) of a particular variable in the server environment. Alternatively, the condition can be expressed as arbitrary boolean expression. If the condition is not satisfied, the request will not be logged. References to HTTP headers in the expression will not cause the header names to be added to the Vary header.

Environment variables can be set on a per-request basis using the error 113 trong pascal and/or modules. For example, if you want to record requests for all GIF images on your server in a separate logfile but not in your main log, you can use:

SetEnvIf Request_URI \.gif$ gif-image CustomLog "gif-requests.log" common env=gif-image CustomLog "nongif-requests.log" common env=!gif-image

Or, to reproduce the behavior of the old RefererIgnore apache error log referer directive, you might use the following:

SetEnvIf Referer example\.com localreferer CustomLog "referer.log" referer env=!localreferer


The directive defines a rentime error 217 at 004bb10d shared by the main server configuration and all defined virtual hosts.

The directive is identical to the directive, apache error log referer, apart from the following differences:

  • is not valid in virtual host context.
  • is used by virtual freebsd root mount error that define their ownunlike a globally specified .


This directive specifies the format of the access log transport tycoon deluxe registry error 1 file.

The directive can take one of two forms. In the first form, where only one argument is specified, this directive sets the log format which will be used by logs specified in subsequent directives. The single argument can specify an explicit as discussed in the custom log formats section above. Alternatively, it can use a to refer to a log format defined in a previous directive as described below.

The second form of the directive associates an explicit with a . This can then be used in subsequent or directives rather than repeating the entire format string. A directive that defines a nickname does nothing else -- that is, it only defines the nickname, it doesn't actually apply the format and make it the default. Therefore, it will not affect subsequent directives. In addition, cannot use one nickname to define another nickname, apache error log referer. Note that the nickname should not contain percent signs ().


LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common


This directive has exactly the same arguments and effect as the apache error log referer directive, with the exception that it does not allow the log format to be specified explicitly or for conditional logging of requests. Instead, the log format is determined by the most recently specified directive which does not define a nickname. Common Log Format is used if no other format has been specified.


LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" TransferLog logs/access_log


Leave a Comment