Created
October 31, 2013 21:19
-
-
Save mrpatrick/7257377 to your computer and use it in GitHub Desktop.
Apache Piped JSON excluding 2xx and 3xx statuses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# JSON extended log format including: User-Agent, Referer, and X-Forwarded-For | |
LogFormat "{ \"time\":\"%t\", \"remoteIP\":\"%a\", \"host\":\"%V\", \"request\":\"%U\", \"query\":\"%q\", \"method\":\"%m\", \"status\":\"%>s\", \"userAgent\":\"%{User-agent}i\", \"referer\":\"%{Referer}i\", \"X-Forwarded-For\":\"%{X-Forwarded-For}i\" }" jsonlog | |
# Pipe only warnings/errors to json log file | |
CustomLog "|/bin/grep -E --invert-match --line-buffered 'status.?[[:punct:]].?[23]' |cat >> /var/log/httpd/errors.json" jsonlog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment