Splunk Search

Help with rex

zindain24
Path Finder

We are looking to create a multi field rex command to capture the following:
1. Firstname Lastname
2. OrgUnit

I am having trouble getting the "Firstname Lastname" to parse properly, here is what I have so far:
|rex field=_raw "(?) CN=(?[^,]+)"

Help is greatly appreciated!

Here is a raw event:
07/18/2012 09:00:29 AM LogName=Security SourceName=Microsoft Windows security auditing. EventCode=4728 EventType=0 Type=Information ComputerName=SERVERNAME.domain.com TaskCategory=Security Group Management OpCode=Info RecordNumber=1688571344 Keywords=Audit Success Message=A member was added to a security-enabled global group. Subject: Security ID: DOMAIN\test003 Account Name: test003 Account Domain: DOMAIN Logon ID: 0x6356e0a1e Member: Security ID: DOMAIN\LOGONID Account Name: CN=Firstname Lastname,OU=OrgUnit,OU=Non-Domain Users,OU=People,DC=company,DC=com Group: Security ID: DOMAIN\SD-INSTALL-ASSET_MANAGEMENT Group Name: GP-GROUP-GROUPNAME_MANAGEMENT Group Domain: DOMAIN Additional Information: Privileges: -

Tags (1)
0 Karma
1 Solution

lguinn2
Legend

Splunk should already be extracting the OrgUnit as it is in field=value format. It will call the field OU, but you can set a field alias if you want a different name. The name is more of a problem, as it contains whitespace.

To extract them both:

 ... | rex field=_raw "CN=(?<cname>.+?),OU=(?<orgunit>\S+)"

To extract just the cname:

 ... | rex field=_raw "CN=(?<cname>.+?),"

View solution in original post

lguinn2
Legend

Splunk should already be extracting the OrgUnit as it is in field=value format. It will call the field OU, but you can set a field alias if you want a different name. The name is more of a problem, as it contains whitespace.

To extract them both:

 ... | rex field=_raw "CN=(?<cname>.+?),OU=(?<orgunit>\S+)"

To extract just the cname:

 ... | rex field=_raw "CN=(?<cname>.+?),"
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...