Splunk Search

Regex help!

kranthi851
New Member

Hi
How can i extract a dn from the following result.

identity:
acd123
cn=abc,ou=..,ou=..,
xyz234
cn=acd,ou=abc,...

I need to extract a new field dn with values starting with cn=.

Tags (1)
0 Karma

sundareshr
Legend

Try this

your base search here | extract pairdelim="," kvdelim="=" | table cn ou 
0 Karma

MuS
SplunkTrust
SplunkTrust

Hi kranthi851,

try this regex:

 your base search here | rex max_match=0 "cn=(?<myNewField>[^,]+)" | do more here ....

The new field will be called myNewField just change it to what fits your use case.

Hope this helps ...

cheers, MuS

Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...