Splunk Search

I need help with rex ad DN field.


my DN field value "cn=jsuwus, jkhzdhkjc,ou=sdsfefv accounts,ou=ffdsrew users,dc=hgsywy,dc=tre,dc=hyt,dc=kuhytr"
I need rex to extract anything after "="and end ",ou=" if it see "=" need to stop two letter and "," so in this instance
cn field as "first_field" value="jsuwus, jkhzdhkjc" 
ou field as "2_field" value="sdsfefv accounts"
ou field as "3_field" value="ffdsrew users"
dc field as "4_field" value="hgsywy"
dc field as "5_field" value="tre"
dc field as "6_field" value="hyt"
dc field as "7_field" value=kuhytr"

Thanks in advance

Labels (2)
0 Karma


OK. Let me stop you right there.

1. It is of course a DN - it has its fields. Why do you want to lose that information?

2. Remember that LDAP DN can have properly escaped commas or equal signs.

0 Karma


Try something like this

| makeresults
| eval dn="cn=jsuwus, jkhzdhkjc,ou=sdsfefv accounts,ou=ffdsrew users,dc=hgsywy,dc=tre,dc=hyt,dc=kuhytr"
| rex field=dn "cn=(?<cn>[^=]+)(?<!,)(?<!o)(?<!u)"
| rex field=dn max_match=0 "ou=(?<ou>[^=]+)(?<!,)(?<!o|d)(?<!u|c)"
| rex field=dn max_match=0 "dc=(?<dc>[^=]+)(?<!,)(?<!d)(?<!c)"
0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...