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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...