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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...