Splunk Search
Highlighted

how to convert ip

Path Finder

Hi

How to convet ip ?

ex)
SRCIP=-1234567890 ===>> SRCIP=1.2.3.4

Tags (1)
0 Karma
Highlighted

Re: how to convert ip

Legend
Highlighted

Re: how to convert ip

Explorer

Try this:

| eval ipsi=-1978431425| eval ip=if(ipsi<1,ipsi+2147483648,ipsi) | eval aaa=floor(ip/16777216) | eval bbb=floor((ip-aaa*16777216)/65536) | eval ccc=floor((ip-(aaa*16777216+bbb*65536))/256)| eval ddd=ip-(aaa*16777216+bbb*65536+ccc*256) | eval ipv4=tostring(aaa)+"."+tostring(bbb)+"."+tostring(ccc)+"."+tostring(ddd) | table ipsi ip ipv4 
Highlighted

Re: how to convert ip

Explorer

For some reason, something consumed the stars meaning multiply - so bbb65536 really means multiply bbb by 65536

0 Karma
Highlighted

Re: how to convert ip

Legend

Fixed. Always indent code blocks with 4 spaces

0 Karma