How to log which node handled a request from httpd?

Solution Verified - Updated

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 LogFormat for more info on the request routing from mod_cluster and mod_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 %w in your JkRequestLogFormat or you can log the name of the mod_jk worker used in your httpd access log by including %{JK_WORKER_NAME}n in your httpd LogFormat(s).
Components
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.