ErrorLogFormat in Apache HTTPD as per JSON specification

Solution Verified - Updated -

Issue

  • On trying to set the below ErrorLogFormat directive in httpd.conf and the output is not following that format in the error log.
ErrorLogFormat '{"apache2":{"timestamp":"%{u}t","virtualhost":"%v","error":{"requestid":"%L","connectionid":"%{c}L","module":"%m","level":"%l","statuscode":"%E","file":"%F","message":"%M","X-REQUEST-UUID":"%{X-REQUEST-UUID}i"},"connection":{"client":{"ip_port":"%a"},"peer":{"ip_port":"%{c}a"},"server":{"ip_port":"%A"},"process":{"id":"%{pid}P","thread":"%{tid}P"}}}}'
ErrorLog "logs/error_json"

Environment

  • Red Hat Enterprise Linux (RHEL)
    • 7.x (httpd 2.4.x)
  • Red Hat JBoss WebServer (JWS)
    • 3.x (httpd 2.4.x)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content