Splunk Search

Splunk - field extraction

chuck_life09
Path Finder

I need to extract a value from this field and update in my table.

Details.Context = "dgfhgjj <Property Name="Name" VariantType="8">TRIMWorkgroup</Property>"

field_name               irrelevant data            when Name="Name" i want the result value (TRIMWorkgroup) in this case as my field value in new field name called "Service"

Help me with a rex command for this.

Labels (1)
Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @chuck_life09,

let me understand:

when you have Name="Name", you want the string between ">" and "<", if this is your need, please try this:

 

| rex field=Details.Context "Name\=\"Name\"[^\>]+\>(?<your_field>[^\<]+)"

 

you can test the regex at https://regex101.com/r/ainfns/1

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @chuck_life09,

let me understand:

when you have Name="Name", you want the string between ">" and "<", if this is your need, please try this:

 

| rex field=Details.Context "Name\=\"Name\"[^\>]+\>(?<your_field>[^\<]+)"

 

you can test the regex at https://regex101.com/r/ainfns/1

Ciao.

Giuseppe

chuck_life09
Path Finder

thank you so much, it worked ...

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @chuck_life09,

good for you!

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated 😉

Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...