{"id":91,"date":"2015-03-30T04:12:11","date_gmt":"2015-03-30T04:12:11","guid":{"rendered":"http:\/\/svops.com\/blog\/?p=91"},"modified":"2015-03-30T04:12:11","modified_gmt":"2015-03-30T04:12:11","slug":"handling-exceptions-in-the-ruby-filter","status":"publish","type":"post","link":"http:\/\/svops.com\/blog\/handling-exceptions-in-the-ruby-filter\/","title":{"rendered":"Handling exceptions in the ruby{} filter"},"content":{"rendered":"<p>If you need to drop into ruby for your processing, be sure to handle any exceptions. \u00a0If you don&#8217;t, the filter worker will exit, possibly halting your processing.<\/p>\n<p>The following code will allow the worker to continue, and will add a field to the event so you can track them down later:<\/p>\n<pre>    ruby {\r\n        code =&gt; \"\r\n          begin\r\n            # your great code goes here\r\n          rescue Exception =&gt; e\r\n            event['ruby_exception'] = 'YOUR_FILTER_NAME: ' + e.message\r\n          end\r\n       \"\r\n    }\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>I add a panel for this field to my cluster health dashboard in kibana.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you need to drop into ruby for your processing, be sure to handle any exceptions. \u00a0If you don&#8217;t, the filter worker will exit, possibly halting your processing. The following code will allow the worker to continue, and will add &hellip; <a href=\"http:\/\/svops.com\/blog\/handling-exceptions-in-the-ruby-filter\/\">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\/91"}],"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=91"}],"version-history":[{"count":1,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":92,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/posts\/91\/revisions\/92"}],"wp:attachment":[{"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/media?parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/categories?post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/svops.com\/blog\/wp-json\/wp\/v2\/tags?post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}