# Ruby exception occurred: -1

**URL:** <https://discuss.elastic.co/t/ruby-exception-occurred-1/107148>\
**Category:** Logstash\
**Created:** [November 10, 2017, 7:50am UTC](https://discuss.elastic.co/t/ruby-exception-occurred-1/107148 "2017-11-10T07:50:50Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Mojster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mojster/32/21209_2.png) [@Mojster](https://discuss.elastic.co/u/Mojster)\
**Post date:** [November 15, 2017, 6:49am UTC](https://discuss.elastic.co/t/ruby-exception-occurred-1/107148/3 "2017-11-15T06:49:57Z")

</div>

```auto
ruby {
		code => "
			a = event.get('message').split('|').delete_if{|x| !x.match(/=/)}
			a.each {|y| b = y.split('=', 2)
				event.set(b[0].strip, b[1])
			}
			event.set('acronym', event.get('acronym').upcase)"
	}

```

To explain my ruby code:

- I had problem with `kv` filter not splitting how it should, so I wrote my own splitter.  
This is explained here:  
[How to handle '=' in values, splitting on | but KV takes over all '=' not only the first](https://discuss.elastic.co/t/how-to-handle-in-values-splitting-on-but-kv-takes-over-all-not-only-the-first/97851)
- Also I've had problem with uppercase so I wrote my own upercase in ruby.

---

_[View the full topic](https://discuss.elastic.co/t/ruby-exception-occurred-1/107148)._
