Skip to content

Commit a1cb32e

Browse files
committed
Update README - add full list of format strings
... and whether they are already supported or not.
1 parent 9f4626f commit a1cb32e

File tree

1 file changed

+40
-24
lines changed

1 file changed

+40
-24
lines changed

README.md

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,46 @@ $parser->setFormat('%h %l %u %t "%r" %>s %O "%{Referer}i" \"%{User-Agent}i"');
5252

5353
## Supported format strings
5454

55-
Here is the list of format strings currently supported :
56-
57-
| Format String | Description |
58-
|----|---------|
59-
| %% | percent |
60-
| %a | remoteIp |
61-
| %A | localIp |
62-
| %h | host |
63-
| %l | logname |
64-
| %m | requestMethod |
65-
| %p | port |
66-
| %r | request |
67-
| %t | time |
68-
| %u | user |
69-
| %U | URL |
70-
| %v | serverName |
71-
| %V | canonicalServerName |
72-
| %> | status |
73-
| %b | responseBytes |
74-
| %O | sentBytes |
75-
| %I | receivedBytes |
76-
| %{Foobar}i | The contents of Foobar: header line(s) in the request sent to the server |
77-
78-
Here is the full list from Apache's doc : https://httpd.apache.org/docs/2.2/en/mod/mod_log_config.html#formats
55+
Here is the full list of [log format strings](https://httpd.apache.org/docs/2.2/en/mod/mod_log_config.html#formats) supported by Apache, and whether they are supported by the library :
56+
57+
| Supported? | Format String | Property name | Description |
58+
|:----------:|:-------------:|---------------|-------------|
59+
| Y | %% | percent |The percent sign |
60+
| Y | %> | status |status |
61+
| Y | %A | localIp |Local IP-address |
62+
| Y | %a | remoteIp |Remote IP-address |
63+
| N | %B | - |Size of response in bytes, excluding HTTP headers. |
64+
| Y | %b | responseBytes |Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent. |
65+
| N | %D | - | The time taken to serve the request, in microseconds. |
66+
| N | %f | - | Filename |
67+
| Y | %h | host |Remote host |
68+
| N | %H | - |The request protocol |
69+
| Y | %I | receivedBytes | Bytes received, including request and headers, cannot be zero. You need to enable mod_logio to use this. |
70+
| N | %k | - | Number of keepalive requests handled on this connection. Interesting if KeepAlive 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 (Y indicating the initial request). Available in versions 2.2.11 and later. |
71+
| Y | %l | logname | Remote logname (from identd, if supplied). This will return a dash unless mod_ident is present and IdentityCheck is set On. |
72+
| Y | %m | requestMethod | The request method |
73+
| Y | %O | sentBytes | Bytes sent, including headers, cannot be zero. You need to enable mod_logio to use this. |
74+
| Y | %p | port | The canonical port of the server serving the request |
75+
| N | %P | - | The process ID of the child that serviced the request. |
76+
| N | %q | - | The query string (prepended with a ? if a query string exists, otherwise an empty string) |
77+
| Y | %r | request | First line of request |
78+
| N | %R | - | The handler generating the response (if any). |
79+
| N | %s | - | Status. For requests that got internally redirected, this is the status of the *original* request --- %>s for the last. |
80+
| N | %T | - | The time taken to serve the request, in seconds. |
81+
| Y | %t | time | Time the request was received (standard english format) |
82+
| Y | %u | user | Remote user (from auth; may be bogus if return status (%s) is 401) |
83+
| Y | %U | URL | The URL path requested, not including any query string. |
84+
| Y | %v | serverName | The canonical ServerName of the server serving the request. |
85+
| Y | %V | canonicalServerName | The server name according to the UseCanonicalName setting. |
86+
| N | %X | - | Connection status when response is completed: X = 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. |
87+
| N | %{Foobar}C | - | The contents of cookie Foobar in the request sent to the server. Only version 0 cookies are fully supported. |
88+
| N | %{Foobar}e | - | The contents of the environment variable FOOBAR |
89+
| Y | %{Foobar}i | *Header | The contents of Foobar: header line(s) in the request sent to the server. Changes made by other modules (e.g. mod_headers) affect this. If you're interested in what the request header was prior to when most modules would have modified it, use mod_setenvif to copy the header into an internal environment variable and log that value with the %{VARNAME}e described above. |
90+
| N | %{Foobar}n | - | The contents of note Foobar from another module. |
91+
| N | %{Foobar}o | - | The contents of Foobar: header line(s) in the reply. |
92+
| N | %{format}p | - | The canonical port of the server serving the request or the server's actual port or the client's actual port. Valid formats are canonical, local, or remote. |
93+
| N | %{format}P | - | The process ID or thread id of the child that serviced the request. Valid formats are pid, tid, and hextid. hextid requires APR 1.2.0 or higher. |
94+
| N | %{format}t | - | The time, in the form given by format, which should be in strftime(3) format. (potentially localized) (This directive was %c in late versions of Apache 1.3, but this conflicted with the historical ssl %{var}c syntax.) |
7995

8096
## Exceptions
8197

0 commit comments

Comments
 (0)