Bug 57402 - Provide correlation ID between mod_jk log and access log
Summary: Provide correlation ID between mod_jk log and access log
Status: NEW
Alias: None
Product: Tomcat Connectors
Classification: Unclassified
Component: mod_jk (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2014-12-30 10:10 UTC by Rainer Jung
Modified: 2019-06-16 14:55 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Jung 2014-12-30 10:10:45 UTC
Since version 2.4 of the Apache web server it has a feature named correlation ID, that allows to log a unique id in the error log and the access log. If you want to identify a request which triggered an error message, you can pick the correlation id from the error message and look for the same id in the access log. The id will be unique per request. Furthermore for cases where the error occured before reading the request, there is also a connection correlation id. The IDs are in the log_id member of the requets and connection structs.

It would be nice if mod_jk would also add the ID to its mod_jk log.

There are several implementation problems though:

- mod_jk doesn't pass a request or connection struct down to the log implementation. So we can't easily access log_id. It might be possible by introducing thread local storage - which is supported by many platforms - and set a TLS pointer to the connection and request objects early during processing.

- Apache sets the log_id not for every request, but only when it needs to write an error message for a request. We could set the log_id fields in mod_jk though (if not already set). It seems Apache won't overwrite them if they are already set (needs checking, see add_log_id() in server/log.c).

- Making this work for Apache before 2.4 must be based on a different storage location for the log_id.

- I haven't thought about making this even work for ISAPI.

I currently don't plan working on this. Patches welcome.