# Ruby exception - Logstash

**URL:** <https://discuss.elastic.co/t/ruby-exception-logstash/138587>\
**Category:** Logstash\
**Created:** [July 4, 2018, 3:09pm UTC](https://discuss.elastic.co/t/ruby-exception-logstash/138587 "2018-07-04T15:09:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![He\_Pamela](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/he_pamela/32/42370_2.png) [@He\_Pamela](https://discuss.elastic.co/u/He_Pamela)\
**Post date:** [July 4, 2018, 3:09pm UTC](https://discuss.elastic.co/t/ruby-exception-logstash/138587/1 "2018-07-04T15:09:37Z")

</div>

I'm getting the ERROR  
[ERROR][logstash.filters.ruby] Ruby exception occurred: End of file reached

this is my ruby.

ruby {  
init =\> "  
require 'net/http'   
require 'uri'  
"  
code =\> "  
direccion = event.get('DIRECC')  
direccion.gsub!(' ','%20')

url = '[https://maps.googleapis.com/maps/api/geocode/json?address='+](https://maps.googleapis.com/maps/api/geocode/json?address='+) direccion + '%20do,%20Aia,%20Ploa'+'&key=AIzaSyDxUNZ7rljYM1I--RiE3SC-7irE41n'

```
uri = URI(url)
res = Net::HTTP.get(uri)   
val = res.body		
		 
 "

```

}  
I concatenated '%20' as a spaces because and example of DIRECC is "CL 40 CR 27 21 INT 500" with spaces, but I have that error.  
Somebody has any idea?

Thanks.

---

<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:** [August 1, 2018, 3:09pm UTC](https://discuss.elastic.co/t/ruby-exception-logstash/138587/2 "2018-08-01T15:09:38Z")

</div>

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