Hi All,
I need to add some field in the events I'm processing with information about the country a phone number belogns to.
So, I'm parsing ok the phone numbers in the events and I want to run ruby code in order to add the country code in the event. For testing porpouses I put the ruby code inline (just with 3 countries) and worked ok, the GeoFrom field was added correctly.
Because the country list is very long I wanted to put the code in an external script, but in this case is not working.
What I'm doing wrong?
Thank you very much
Ana
**Logstash configuration**
grok{....}
date{...}
mutate{....}
ruby {
path => "/data/sbc/geo_info/geo.rb"
}
.....
geo.rb code
def filter (event)
case event.get('from')
when /\A376(.*)/
event.set('GeoFROM','AD')
when /\A34(.*)/
event.set('GeoFROM','ES')
when /\A39(.*)/
event.set('GeoFROM','IT')
else
event.set('GeoFROM','KK')
end
return [event]
end