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
Legend

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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...