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!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...