How to log which node handled a request from httpd?
Environment
- Red Hat Enterprise Linux (RHEL)
- Red Hat Software Collections (RHSCL)
- Red Hat JBoss Core Services (JBCS)
- JBoss Enterprise Web Server (EWS)
- Apache Web Server (HTTPD)
- mod_cluster
- mod_proxy
- mod_jk
Issue
- We use an httpd balancer in front of JBoss. How can we log in the httpd access logs which JBoss node served the request?
Resolution
- You can add the following to your httpd
LogFormatfor more info on the request routing frommod_clusterandmod_proxy_balancer:%{BALANCER_NAME}e: logs the name of the balancer that served the request%{BALANCER_WORKER_NAME}e: logs the name of the balancer member that served the request
- For
mod_jk, include%win yourJkRequestLogFormator you can log the name of the mod_jk worker used in your httpd access log by including%{JK_WORKER_NAME}nin your httpd LogFormat(s).- If using load balancing worker i.e.
type=lb,%{JK_WORKER_ROUTE}ncan be used in the LogFormat(s) to print the mod_jk worker used in your httpd access log. More details can be referred to Content from tomcat.apache.org is not included.here.
- If using load balancing worker i.e.
SBR
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.