Last active
August 29, 2015 14:27
-
-
Save markstgodard/18fcb762a60f7d2ea791 to your computer and use it in GitHub Desktop.
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
See: https://github.com/cloudfoundry/gorouter/pull/92 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GoRouter Access Log Record format and parsability
See: cloudfoundry/gorouter#92
Taking example access log records with new optional headers (embedded JSON vs. existing format) and then using Logstash GROK patterns to parse elements. Also this example is just using Logstash as an example log parsing technology.
In this example: we want to also optionally log the following headers: Cache-Control, Span-Id, Trace-Id
Note: The above pattern was just hacked together, to get an idea of the tokens, etc. This is not an official GoRouter Access Log Logstash Grok pattern :)
In this case I just consumed the last element as GREEDYDATA pattern, since I didnt see any nice way of having an existing GROK pattern and then also parsing JSON. Logstash supports parsing JSON log statements, however I didnt see a way to cleanly combine GROK and JSON.
It is likely possible to just create a custom GROK / regex pattern to include, however this would add complexity.
Note: The above can continue to parse the optional header elements included at the END of the existing access log record
In this case where the access log format uses key:"value(s)" for the optional headers, it would be simpler to parse and would keep things consistent.