Convert decimal IP to ipv4 dotted decimal

Found the problem. I had some extra single quotes, and the integers were negative so I had to drop the minus sign.

This version works:

		if [sourceipv4] {
			ruby{
				code => "require 'ipaddr'
						decimalip = event['sourceipv4'].abs
						event['ip'] = IPAddr.new(decimalip,Socket::AF_INET).to_s"
			}
2 Likes