Splunk Search

Windows Security Logs: Regex Filtering Search time

arrowsmith3
Path Finder

I have a windows security event that I am trying to extract a custom field for failed logon events. The problem I have is there are two duplicate categories and the text I am after is in the second category:

Ex:
Subject:
Security ID: S-1-0-0
Account Name: -
Account Domain: -
Logon ID: 0x0
Logon Type: 3
Account For Which Logon Failed:
Security ID: S-1-0-0
Account Name: PCVS Operator
Account Domain: PCVSB681-2

Normally I would just put in rex "Account Name:(?.+)" to extract the content of this field but since there is two of them, is there a way to skip the first field and go directly to the second?

Thanks!

Tags (3)
0 Karma
1 Solution

arrowsmith3
Path Finder

This resolved my question, thanks goes to ziegfried.

rex "(?ms)Account For Which Logon Failed.+?Account Name:\s+(?\V+)"

View solution in original post

0 Karma

arrowsmith3
Path Finder

This resolved my question, thanks goes to ziegfried.

rex "(?ms)Account For Which Logon Failed.+?Account Name:\s+(?\V+)"

0 Karma

arrowsmith3
Path Finder

Thank you but that didnt work, when I apply that to my search string it will list the entire content of the event.

Any other suggestions?

0 Karma

_d_
Splunk Employee
Splunk Employee

Try this:

| rex "(?ms)Account Name.*Account Name:(?<account>.+)"

Hope it helps.

> please upvote and accept answer if you find it useful - thanks!

Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...