-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log4r vs Logstash #7
Comments
Depending on how logstash parses it, you may be able to do so right now via log4r's MDC by setting the prefix to and empty string ( https://github.com/wr0ngway/log4r-gelf/blob/master/lib/log4r-gelf/gelf_outputter.rb#L90 )
then in your code
which would result in a "_tags" key in the gelf message. You may need a logstash filter to strip the underscore. I tend not to use tags but instead just use MDC with real keys/values since the graylog webui hotlinks custom gelf fields (preceeding underscore). If this doesn't work, or you'd like something thats less of a hack, feel free to submit a PR. |
Although, now that I look at the logstash doc you linked to, I think that tags fields in the logstash config is globally applied to all events received from gelf. Not sure if having a tags field in the event will override its values. |
That is what I tried, but it doesn't work for a few reasons. MDC key/pairs are a subset of @fields, for example @fields._pp, due to the underscore which can't be removed. They are also subject to .inspect which would render them in quotes. Could tags just be added and merged here https://github.com/wr0ngway/log4r-gelf/blob/master/lib/log4r-gelf/gelf_outputter.rb#L25 and https://github.com/wr0ngway/log4r-gelf/blob/master/lib/log4r-gelf/gelf_outputter.rb#L48 (allowing tags to be added to all or individual events)? |
We're using Log4r with Logstash via Gelf. Is there a reason that "we" couldn't support tags? http://logstash.net/docs/1.2.2/inputs/gelf#tags
The text was updated successfully, but these errors were encountered: