Splunk Search

Getting reverse of IP address occurring in event ex " 2.20.111.140" should be shown as "140.111.20.2"

yogeshpunia05
Explorer

Events have IP address and are needed to be shown in reverse form .

" 2.20.111.140" should be shown as "140.111.20.2"

0 Karma
1 Solution

yogeshpunia05
Explorer

Thanks mehala for solution:

eval myField="2.20.111.140" |  rex field=myField mode=sed "s/(\d+)\.(\d+)\.(\d+)\.(\d+)/\4.\3.\2.\1/g".

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Here's one way.

... | rex field=IPAddress "(?P<o1>\d+)\.(?P<o2>\d+)\.(?P<o3>\d+)\.(?P<o4>\d+)" | eval revIPAddress = o4.".".03.".".o2.".".01 | ...
---
If this reply helps you, Karma would be appreciated.
0 Karma

yogeshpunia05
Explorer

Thanks mehala for solution:

eval myField="2.20.111.140" |  rex field=myField mode=sed "s/(\d+)\.(\d+)\.(\d+)\.(\d+)/\4.\3.\2.\1/g".
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...