Hello,
I am reading data from an SQL table which contains IP addresses in decimal format, and I need to convert these to dotted decimal. e.g.
convert this: 1978211278
to this: 117.233.27.206
I am trying to do this with a Ruby filter using the ipaddr method:
if [sourceipv4] {
ruby{
code => "require 'ipaddr'
decimalip = event['sourceipv4']
event['ip'] = IPAddr.new('decimalip',Socket::AF_INET).to_s()"
}
}
...where sourceipv4 is my decimal ip address, but this gives me this error:
{:timestamp=>"2016-12-05T14:41:55.019000-0800", :message=>"Ruby exception occurred: address family mismatch", :level=>:error}
{:timestamp=>"2016-12-05T14:41:55.020000-0800", :message=>"Ruby exception occurred: address family mismatch", :level=>:error}
{:timestamp=>"2016-12-05T14:41:55.020000-0800", :message=>"Ruby exception occurred: address family mismatch", :level=>:error
Can anyone assist please?
Thank you