Splunk Search

How can I parse out both the Named Address and IP Address and format them into an Extracted Field?

justdan23
Path Finder

The log entry I have has:

Message=DNS query is completed for the name my.big.server.name.com, type 28, query options 1073897472 with status 0 Results ::ffff:10.2.1.20

How can I extract both the Named Address and IP Address into one Extracted Field with the value:

my.big.server.name.com (10.2.1.20)

The UI gives me an option to provide my own regex, but it clips the text:

DNS query is completed for the name (?P <dns_lookup>[^\, type]+)
Tags (1)
0 Karma

Vijeta
Influencer

@justdan23

You can use the rex commands and get final output by concatenating .

<your query>| rex field=_raw "\s+(?<domain>\w+\.\w+\.\w+\.\w+\.\w+)"| rex field=_raw "\S+:(?<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"| eval fname=domain+" "+ip
0 Karma

justdan23
Path Finder

Note: The code block in this interface adds the numbers when trying to block a data sample.

Is there a better way for me to format this?

The Preview doesn't show the numbers before I posted it.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...