Last active
August 29, 2015 14:00
-
-
Save spuder/edd6058ca969aa484a94 to your computer and use it in GitHub Desktop.
Troubleshoot logstash grok logs
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
| #This config does not work, it never enters the if [tag] == derp block | |
| input { | |
| stdin {} | |
| } | |
| filter { | |
| grok { | |
| #match => [ "message", ".*" ] | |
| match => [ "message", "%{GREEDYDATA}" ] | |
| add_tag => [ "derp" ] | |
| } | |
| } | |
| output { | |
| # Why does this if statement not work? | |
| if [tag] == "derp" { | |
| stdout {} | |
| email { | |
| to => "spuder@foo.com" | |
| from => "logstash@foo.com" | |
| subject => "herp" | |
| body => "herp a derp %{message}" | |
| via => "sendmail" | |
| } | |
| } | |
| # IF I change tag to type => foo, then logstash works properly, it seems that you can perform conditionals on tags. | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
because tags are an array, you need to use the following (thanks coolacid in irc)