Last active
April 10, 2024 13:37
-
-
Save kosho/82546a86140ad67c866e8197d730c53c to your computer and use it in GitHub Desktop.
Structured logging example configurations
This file contains 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
# Apache httpd | |
- input_type: log | |
paths: | |
- /var/log/httpd/access_log.js | |
document_type: apache | |
json.keys_under_root: true | |
json.add_error_key: true | |
# Squid | |
- input_type: log | |
paths: | |
- /var/log/squid/access_log.js | |
document_type: squid | |
json.keys_under_root: true | |
json.add_error_key: true |
This file contains 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
LogFormat "{ \"clientip\": \"%h\", \"ident\": \"%l\", \"auth\": \"%u\", \"timestamp\": \"%{%FT%T%z}t\", \"verb\": \"%m\", \"request\": \"%U%q\", \"httpversion\": \"%H\", \"response\": %>s, \"bytes\": %b, \"referer\": \"%{Referer}i\", \"agent\": \"%{User-agent}i\" }" combinedjson | |
CustomLog logs/access_log.js combinedjson |
This file contains 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
logformat combinedjson { "clientip": "%>a", "ident": "%ui", "uname": "%un", "timestamp": "%{%FT%T%z}tg", "verb": "%rm", "request": "%ru", "httpversion": "HTTP/%rv", "response": %>Hs, "bytes": %<st, "referer": "%{Referer}>h", "agent": "%{User-Agent}>h", "request_status": "%Sh", "hierarchy_status": "%Sh" } | |
access_log /var/log/squid/access_log.js combinedjson |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think there is a small mistake in squid.conf line 1, for the combinedjson the %Sh is used twice.
, "request_status": "%Sh", "hierarchy_status": "%Sh"
should be
, "request_status": "%Ss", "hierarchy_status": "%Sh"