# Ruby filter causing logstash to continually restart

**URL:** <https://discuss.elastic.co/t/ruby-filter-causing-logstash-to-continually-restart/157612>\
**Category:** Logstash\
**Created:** [November 20, 2018, 9:18pm UTC](https://discuss.elastic.co/t/ruby-filter-causing-logstash-to-continually-restart/157612 "2018-11-20T21:18:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![agx](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@agx](https://discuss.elastic.co/u/agx)\
**Post date:** [November 20, 2018, 9:18pm UTC](https://discuss.elastic.co/t/ruby-filter-causing-logstash-to-continually-restart/157612/1 "2018-11-20T21:18:07Z")

</div>

Hello,

I have the following ruby filter in my logstash config:

# ruby {

# code =\> "unless event.get('delivered') == 0 event.set('openrate', event.get('opens')/event.get('delivered')) end"

# }

when I uncomment this filter, I don't get any errors, but the logstash log shows that the service is continually restarting. All I want to do is:

if "delivered" is non-zero create new field "openrate" by dividing "opens" by "delivered"  
i'm not sure what do to next.. is it a formatting issue? if the ruby code doesn't make sense, i don't understand why it's not throwing an error...

I'm using version 5.6.x

log:  
[2018-11-20T15:47:13,048][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"netflow", :directory=\>"/usr/share/logstash/modules/netflow/configuration"}  
[2018-11-20T15:47:13,051][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"fb\_apache", :directory=\>"/usr/share/logstash/modules/fb\_apache/configuration"}  
[2018-11-20T15:47:14,559][INFO][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=\>{:removed=\>, :added=\>[[http://localhost:9200/](http://localhost:9200/)]}}  
[2018-11-20T15:47:14,560][INFO][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck\_url=\>[http://localhost:9200/](http://localhost:9200/), :path=\>"/"}  
[2018-11-20T15:47:14,634][WARN][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=\>"[http://localhost:9200/](http://localhost:9200/)"}  
[2018-11-20T15:47:14,668][INFO][logstash.outputs.elasticsearch] New Elasticsearch output {:class=\>"LogStash::Outputs::ElasticSearch", :hosts=\>["[//localhost:9200](https://localhost:9200)"]}  
[2018-11-20T15:47:14,673][INFO][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=\>{:removed=\>, :added=\>[[http://localhost:9200/](http://localhost:9200/)]}}  
[2018-11-20T15:47:14,673][INFO][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck\_url=\>[http://localhost:9200/](http://localhost:9200/), :path=\>"/"}  
[2018-11-20T15:47:14,676][WARN][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=\>"[http://localhost:9200/](http://localhost:9200/)"}  
[2018-11-20T15:47:14,687][INFO][logstash.outputs.elasticsearch] New Elasticsearch output {:class=\>"LogStash::Outputs::ElasticSearch", :hosts=\>["[//localhost:9200](https://localhost:9200)"]}  
[2018-11-20T15:47:15,142][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}  
... after about 8 seconds it will re-init starting here:  
[2018-11-20T15:47:23,034][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"netflow", :directory=\>"/usr/share/logstash/modules/netflow/configuration"}  
[2018-11-20T15:47:23,037][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"fb\_apache", :directory=\>"/usr/share/logstash/modules/fb\_apache/configuration"}  
[2018-11-20T15:47:24,399][INFO][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=\>{:removed=\>, :added=\>[[http://localhost:9200/](http://localhost:9200/)]}}  
[2018-11-20T15:47:24,400][INFO][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck\_url=\>[http://localhost:9200/](http://localhost:9200/), :path=\>"/"}  
[2018-11-20T15:47:24,472][WARN][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=\>"[http://localhost:9200/](http://localhost:9200/)"}  
[2018-11-20T15:47:24,507][INFO][logstash.outputs.elasticsearch] New Elasticsearch output {:class=\>"LogStash::Outputs::ElasticSearch", :hosts=\>["[//localhost:9200](https://localhost:9200)"]}  
[2018-11-20T15:47:24,512][INFO][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=\>{:removed=\>, :added=\>[[http://localhost:9200/](http://localhost:9200/)]}}  
[2018-11-20T15:47:24,512][INFO][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck\_url=\>[http://localhost:9200/](http://localhost:9200/), :path=\>"/"}  
[2018-11-20T15:47:24,515][WARN][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=\>"[http://localhost:9200/](http://localhost:9200/)"}  
[2018-11-20T15:47:24,525][INFO][logstash.outputs.elasticsearch] New Elasticsearch output {:class=\>"LogStash::Outputs::ElasticSearch", :hosts=\>["[//localhost:9200](https://localhost:9200)"]}  
[2018-11-20T15:47:24,911][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 18, 2018, 9:18pm UTC](https://discuss.elastic.co/t/ruby-filter-causing-logstash-to-continually-restart/157612/2 "2018-12-18T21:18:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
