All Apps and Add-ons

how to extract an ip field and host name field from dest field into two diff fields

umsundar2015
Path Finder

for ex my dest field has values like ,
ukepidmng104a.uk.standardchartered.com

10.193.60.17
I need to extract like host_name =ukepidmng104a and dest_ip=10.193.60.17
Meanwhile , the field values should have null in dest_ip field rows in host_name field and null in host_name in dest_ip field values.

0 Karma
1 Solution

bshuler_splunk
Splunk Employee
Splunk Employee

I couldn't deduce exactly what you started with, and what you needed, but I took a stab at it. I hope this query helps you:

| makeresults | eval dest = "ukepidmng104a.uk.standardchartered.com,10.193.60.17" | rex field=dest max_match=2 "(?<dest>[^,]+)"| mvexpand dest | eval dest_ip=if(match(dest, "\d+\.\d+\.\d+\.\d+"), dest, null()) | eval host_name=if(match(dest, "\d+\.\d+\.\d+\.\d+"), null(), dest)

View solution in original post

0 Karma

umsundar2015
Path Finder

thank you..

0 Karma

bshuler_splunk
Splunk Employee
Splunk Employee

I couldn't deduce exactly what you started with, and what you needed, but I took a stab at it. I hope this query helps you:

| makeresults | eval dest = "ukepidmng104a.uk.standardchartered.com,10.193.60.17" | rex field=dest max_match=2 "(?<dest>[^,]+)"| mvexpand dest | eval dest_ip=if(match(dest, "\d+\.\d+\.\d+\.\d+"), dest, null()) | eval host_name=if(match(dest, "\d+\.\d+\.\d+\.\d+"), null(), dest)
0 Karma
Get Updates on the Splunk Community!

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 ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...