Log Formatting Directives

 Formatting Options  Explanation
   Data from the Client
 %a  Remote IP address, from the client.
 %h Hostname or IP address of the client making the request. Whether the hostname is logged depends on two factors: The IP address of the client must be able to resolve to a hostname using a reverse DNS lookup, and Apache must be configured to do that lookup using the HostNameLookups directive, explained later in this hour. If these conditions are not met, the IP address of the client will be logged instead.
 %l Remote user, obtained via the identd protocol. This option is not very useful because this protocol is not supported on the majority of the client machines, and the results can’t be trusted anyway because the client provides them.
%u   Remote user from the HTTP basic authentication protocol.
   Data from the Server
 %A  Local IP address, from the server.
 %D  Time it took to serve the request in microseconds.
 %{env_variable}e  Value for an environment variable named env_variable.
 %{time_format}t Current time. If {time_format} is present, it will be interpreted as an argument to the Unix strftime function. See the logresolve Apache manual page for details.
 %T  Time it took to serve the request, in seconds.
 %v  Canonical name of server that answered the request.
 %V  Server name according to the UseCanonicalName directive.
 %X Status of the connection in the server. A value of ‘x’ means the connection was aborted before the server could send the data. A ‘+’ means the connection will be kept alive for further requests from the same client. A ‘-’ means the connection will be closed.
   Data from the Request
 %{cookie_name}C  Value for a cookie named cookie_name.
 %H      Request protocol, such as HTTP or HTTPS.
 %m  Request method such as GET, POST, PUT, and so on.
 %{header_name}i Value for a header named header_name in the request from the client. This can be useful, for example, to log the names and versions of your visitors’ browsers.
 %r  Text of the original HTTP request.
 %q  Query parameters, if any, prefixed by a ?.
 %U  Requested URL, without query parameters.
   Data from the Response
 %b, %B Size, in bytes, of the body of the response sent back to the client (excluding headers). The only difference between the options is that if no data was sent, %b will log a ‘-’ and %B will log ‘0’.
 %f  Path of the file served, if any.
 %t  Time when the request was served.
 %{header_name}o  Value for a header named header_name in the response to the client.
 %>s Final status code. Apache can process several times the same request (internal redirects). This is the status code of the final response

Source : Daniel Lopez Ridruezo; SAMS Teach Yourself Apache2 in 24 Hours, SAMS Publishing, 2002