With mod_log you can log headers sent back to the client in the access.log file with the %{Set-Cookie}o directive. But if there are multiple occurences of the same header, as is authorized by the HTTP RPC, only one gets logged.

How can we have all of them logged ?

For reference, the RFC states :

Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)].

Set-Cookie is such a field-name since the field-value is comma-separated. I would not mind to have them joined together as suggested in the HTTP RPC.

link|improve this question

feedback

2 Answers

What version of apache? what version of mod_log? The correct answer may be to either file a bug report with apache or patch it in yourself.

link|improve this answer
Yeah, i was stuck with a 1.3. But when I tried with 2.2 it worked flawlessly, hence my answer. – Steve Schnepp Jun 10 '09 at 15:57
+1 since it doesn't answers, but made me think about trying with another version :-) – Steve Schnepp Jun 10 '09 at 15:58
feedback
up vote 0 down vote accepted

Actually, since version 2.0, It works out-of-the-box, except for Content-type : every header gets nicely concatenated with a comma as suggested in the HTTP RFC.

The "Set-Cookie" response header also has a special treatment as we can see in the log_header_out function of modules/loggers/mod_log_config.c :

// ... start of snippet ...
if (!strcasecmp(a, "Content-type") && r->content_type) {
    cp = ap_field_noparam(r->pool, r->content_type);
}
else if (!strcasecmp(a, "Set-Cookie")) {
    cp = find_multiple_headers(r->pool, r->headers_out, a);
}
else {
    cp = apr_table_get(r->headers_out, a);
}
// ... end of snippet ...
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.