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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...