Splunk Search

Writing rex to grep a value from the field

nivethainspire_
Explorer

I have 3 different values to be extracted. Please help me in writing rex command

here is the field values
name="ascd23:deo"
name="adcs44.sys.com"
name="aswdc-w.foul.com"

I need values as below
name=ascd23
name=adcs44
name=aswdc-w
I need a rex command

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

So... everything before the first dot or colon, not including quotes?

If you already have the name field key-value-extracted, try this:

... | rex field=name "^(?<name>[^.:]+)"

If you don't already have the name field, try this:

... | rex "name=\"(?<name>[^.:\"]+)"

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

So... everything before the first dot or colon, not including quotes?

If you already have the name field key-value-extracted, try this:

... | rex field=name "^(?<name>[^.:]+)"

If you don't already have the name field, try this:

... | rex "name=\"(?<name>[^.:\"]+)"
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 ...