Skip to content

Splunk command to convert a field with IP4 decimal format to a new field in the dotted-decimal address format.

Notifications You must be signed in to change notification settings

rzzldzzl/splunk_dec2ip_command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Author: Joe Rizzo


Converts a field with IP4 decimal format to a new field in the dotted-decimal address format.

Usage: | dec2ip

Example: | stats count | fields - count | eval dec="2046352469" | dec2ip dec ip

Based on: http://stackoverflow.com/questions/9590965/convert-an-ip-string-to-a-number-and-vice-versa ip2int = lambda ip: reduce(lambda a, b: (a << 8) + b, map(int, ip.split('.')), 0) int2ip = lambda n: '.'.join([str(n >> (i << 3) & 0xFF) for i in range(0, 4)[::-1]])

About

Splunk command to convert a field with IP4 decimal format to a new field in the dotted-decimal address format.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages