Bug 62384 - %{VARNAME}i in Logformat ignores comma immediately following the variable
Summary: %{VARNAME}i in Logformat ignores comma immediately following the variable
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_log_config (show other bugs)
Version: 2.4.23
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2018-05-18 08:48 UTC by jm+asfbugzilla
Modified: 2018-05-18 09:11 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description jm+asfbugzilla 2018-05-18 08:48:20 UTC
In fact I believe it ignores anything but a space.

Using the following LogFormat:

   LogFormat '"%t", %h, %{Authorization}i, %H, %m, "%U", "%q", %>s, %b, "%{User-agent}i"'

gives the following results:

1) When an authorization header exists:
"[18/May/2018:10:21:07 +0200]",, user HTTP/1.1, GET, "/path/to/file", "", 200, 374, "Wget/1.18 (linux-gnu)"

2) When no authorization header exists:
"[18/May/2018:10:21:07 +0200]",, -, HTTP/1.1, GET, "/path/to/file", "", 200, 374, "Wget/1.18 (linux-gnu)"

Note that in the first example the comma following the authorization header value is missing!

If you define the log format as follows:
LogFormat '"%t", %h, %{Authorization}i , %H, %m, "%U", "%q", %>s, %b, "%{User-agent}i"'

then it will successfully write the comma, but there will be a space (obviously)

"[18/May/2018:10:21:07 +0200]",, user , HTTP/1.1, GET, "/path/to/file", "", 200, 374, "Wget/1.18 (linux-gnu)"

It should be possible to use another delimiter than a space everywhere...
Comment 1 jm+asfbugzilla 2018-05-18 09:11:18 UTC
Forget it. My bad. There's more to this: there's a customlog directive with a pipe to a script here. I think the script is swallowing the separator. Sorry...