# Ruby Filter change in 5

**URL:** <https://discuss.elastic.co/t/ruby-filter-change-in-5/66437>\
**Category:** Logstash\
**Created:** [November 17, 2016, 5:36pm UTC](https://discuss.elastic.co/t/ruby-filter-change-in-5/66437 "2016-11-17T17:36:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hans](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@Hans](https://discuss.elastic.co/u/Hans)\
**Post date:** [November 17, 2016, 5:36pm UTC](https://discuss.elastic.co/t/ruby-filter-change-in-5/66437/1 "2016-11-17T17:36:41Z")

</div>

Hi, I have been using a Ruby filter for some of by information, however since I have upgraded to 5 these no longer work. I have tried to understand exactly what changes under [https://www.elastic.co/guide/en/logstash/5.x/breaking-changes.html](https://www.elastic.co/guide/en/logstash/5.x/breaking-changes.html) however without success. Could I kindly get assistance with the change of the filter to be compatible again with Logstash 5?

Here are my two filters I use:  
`ruby{ code=>"event['Duration_m'] = (event['Duration_s'] / 60.00).round(2)" }`

`ruby{ code=>"event['vol_KB'] = (event['vol_bytes'] / 1000)" }`

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 18, 2016, 6:31am UTC](https://discuss.elastic.co/t/ruby-filter-change-in-5/66437/2 "2016-11-18T06:31:57Z")

</div>

See [https://www.elastic.co/guide/en/logstash/current/event-api.html#\_event\_api](https://www.elastic.co/guide/en/logstash/current/event-api.html#_event_api).

---

<div class="post-metadata">

**Author:** ![fh8510](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@fh8510](https://discuss.elastic.co/u/fh8510)\
**Post date:** [November 18, 2016, 10:30pm UTC](https://discuss.elastic.co/t/ruby-filter-change-in-5/66437/3 "2016-11-18T22:30:50Z")

</div>

Hans,  
the bottom of the page you list ([Breaking changes][https://www.elastic.co/guide/en/logstash/5.x/breaking-changes.html](https://www.elastic.co/guide/en/logstash/5.x/breaking-changes.html)) summarizes what you are facing... see the bottom of the link, under:  
'Ruby Filter and Custom Plugin Developers'. It's a nice summary of what changed in ruby filter and how you need to modify your code.

The link Magnus lists goes into the change in more detail.

---

<div class="post-metadata">

**Author:** ![Hans](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@Hans](https://discuss.elastic.co/u/Hans)\
**Post date:** [November 19, 2016, 2:29pm UTC](https://discuss.elastic.co/t/ruby-filter-change-in-5/66437/4 "2016-11-19T14:29:24Z")

</div>

Thank you very much @magnusbaeck and @fh8510, I will go through the documentation and try to find the correct syntax to be compatible in 5 again.

---

<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 17, 2016, 2:29pm UTC](https://discuss.elastic.co/t/ruby-filter-change-in-5/66437/5 "2016-12-17T14:29:24Z")

</div>

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