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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...