{"id":95,"date":"2015-03-30T04:28:24","date_gmt":"2015-03-30T04:28:24","guid":{"rendered":"http:\/\/svops.com\/blog\/?p=95"},"modified":"2015-03-30T04:28:24","modified_gmt":"2015-03-30T04:28:24","slug":"using-conditionals-in-your-filter-blocks","status":"publish","type":"post","link":"http:\/\/svops.com\/blog\/using-conditionals-in-your-filter-blocks\/","title":{"rendered":"Using conditionals in your filter{} blocks"},"content":{"rendered":"<p>Wrapping your filter logic in conditional expressions can be very important.<\/p>\n<p>If your configuration is split up into many files, logstash will combine and run all of the stanzas. \u00a0Also, using conditionals to limit the amount of processing performed will make this step faster.<\/p>\n<p>To tell if an event contains a given tag:<\/p>\n<pre>if \"value\" in [tags] {\r\n}\r\n\r\n<\/pre>\n<p>For string fields:<\/p>\n<pre>if [FIELD] =~ \/.+\/ {\r\n     # exists\r\n}\r\n \r\nif [FIELD] !~ \/.+\/ {\r\n     # doesn't exist\r\n}\r\n<\/pre>\n<p>For numeric fields:<\/p>\n<pre>if [FIELD] {\r\n     # exists\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Wrapping your filter logic in conditional expressions can be very important. If your configuration is split up into many files, logstash will combine and run all of the stanzas. \u00a0Also, using conditionals to limit the amount of processing performed will &hellip; <a href=\"http:\/\/svops.com\/blog\/using-conditionals-in-your-filter-blocks\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/posts\/95"}],"collection":[{"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":1,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":96,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/posts\/95\/revisions\/96"}],"wp:attachment":[{"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}