Log Outgoing Apache Port on AJP Connection

Andy asked:

I have Tomcat 7 set up to work with mod_jk and AJP. I’m wondering if, on the Tomcat side, I can log the mod_jk (Apache side) outgoing port with the Tomcat request handler thread name in order to track end-to-end network traffic.

My answer:

The remote port number is available to your application in the environment variable JK_REMOTE_PORT.

There’s no corresponding JkRequestLogFormat string to log the remote port, but it can be logged in a standard Apache mod_log_config request log with %{remote}p in LogFormat.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.