Web Server Management: Running Apache 2.2 under Linux | ||
---|---|---|
Prev |
Table B-1. Escape sequences for custom logs
%% | How to get "%" in the log line. Why would you want to? |
%a | Client IP address |
%A | Server IP address. Recall that you may be running different virtual hosts on different IP addresses. |
%B | Number of data bytes sent back. (i.e. excluding headers) |
%b | As for %B except that if the number is 0 then "-" is inserted instead. |
%{fubar}C | The value of cookie fubar. |
%D | The number of microseconds it took to serve the query. See %T below for a less accurate representation. |
%{fubar}e | The value of environment variable fubar when the query was processed. |
%f | The name of the file whose contents were ultimately served back to the client. |
%H | The request protocol. (Typically HTTP or HTTPS.) |
%{fubar}i | Value of the fubar header on the input query. See also %o below. |
%l | The remote userid, if provided by RFCnnnn. |
%m | The request method. Typically "GET" for our queries, but occasionally "HEAD" if the browser is smart. It may be "POST" for some CGI programs uploading data. |
%{fubar}n | A record of a "note" passed from one module to another. Not of interest at our level. |
%{fubar}o | The value of header fubar in the outgoing response headers. See also %i above. |
%p | The port number of the server. Typically 80. |
%P | The process ID of the child that serviced the query. Typically only of use for debugging and trouble-shooting. |
%q | The query string component of the URL. |
%r | The first line of the query. |
%>s | The status code passed back to the client. |
%t | The time of the request in standard format. |
%{format}t | The time of the query in the format specified. See
the manual page for |
%T | The time taken to service the query in seconds. See %D above for more accuracy. |
%u | The userid used to authenticate to this page, if necessary. |
%U | The URL requested without the server name and protocol elements and without any trailing query string. |
%v | The server name for the virtual host that was given the query. |
HTTP (RFC 2616) is a very subtle protocol with much more happening than you might expect from the simple stuff we have been covering. The following table lists all the status codes it has and which might find themselves in your log files. In practise you will only see a tiny subset of them.
Table B-2. HTTP status codes
100 | Continue |
101 | Switching protocols |
200 | OK |
201 | Created |
202 | Accepted |
203 | Nonauthoritative information |
204 | No content |
205 | Reset content |
206 | Partial content |
300 | Multiple choices |
301 | Moved permanently |
302 | Found |
303 | See other |
304 | Not modified |
305 | Use proxy |
307 | Temporary redirect |
400 | Bad request |
401 | Unauthorized |
402 | Payment required |
403 | Forbidden |
404 | Not found |
405 | Method not allowed |
406 | Not acceptable |
407 | Proxy authentication required |
408 | Request time-out |
409 | Conflict |
410 | Gone |
411 | Length required |
412 | Precondition failed |
413 | Request entity too large |
414 | Request URI too large |
415 | Unsupported media type |
416 | Requested range not satisfiable |
417 | Expectation failed |
500 | Internal server error |
501 | Not implemented |
502 | Bad gateway |
503 | Service unavailable |
504 | Gateway timed out |
505 | HTTP version unsupported |