Splunk Dev

Filter out events Windows before Indexing

jfeitosa_real
Path Finder

Hi Guys!

How to create a filter to discard Windows logon events (EventID = 4624), but only when the LogonProcessName field is equal to 'NtLmSsp'?

The logs are in XML format.

I've tried several REGEX, but none worked.

Please, who has an idea?

<Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='Microsoft-Windows-Security-Auditing' Guid='{54645625-5678-4344-A5AA-E3A0356C30D}'/>
<EventID>4624/EventID><Version>2</Version><Level>0</Level><Task>12544</Task><Opcode>0</Opcode><Keywords>0x8020000000000000</Keywords><TimeCreated SystemTime='2019-01-29T16:09:38.913252400Z'/><EventRecordID>602433466</EventRecordID><Correlation/><Execution ProcessID='612' ThreadID='11820'/><Channel>Security</Channel><Computer>DC01.mydomain.com</Computer><Security/></System><EventData><Data Name='SubjectUserSid'>NULL SID</Data><Data Name='SubjectUserName'>-</Data><Data Name='SubjectDomainName'>-</Data><Data Name='SubjectLogonId'>0x0</Data><Data Name='TargetUserSid'>MTI\user01</Data><Data Name='TargetUserName'>user01</Data><Data Name='TargetDomainName'>mydomain</Data><Data Name='TargetLogonId'>0x280731681</Data><Data Name='LogonType'>3</Data><Data Name='LogonProcessName'>NtLmSsp </Data><Data Name='AuthenticationPackageName'>NTLM</Data><Data Name='WorkstationName'>COMP01</Data><Data Name='LogonGuid'>{00000000-0000-0000-0000-000000000000}</Data><Data Name='TransmittedServices'>-</Data><Data Name='LmPackageName'>NTLM V2</Data><Data Name='KeyLength'>0</Data><Data Name='ProcessId'>0x0</Data><Data Name='ProcessName'>-</Data><Data Name='IpAddress'>-</Data><Data Name='IpPort'>-</Data><Data Name='ImpersonationLevel'>%%1833</Data><Data Name='RestrictedAdminMode'>-</Data><Data Name='TargetOutboundUserName'>-</Data><Data Name='TargetOutboundDomainName'>-</Data><Data Name='VirtualAccount'>%%1843</Data><Data Name='TargetLinkedLogonId'>0x0</Data><Data Name='ElevatedToken'>%%1842</Data></EventData></Event>

props.conf
[XmlWinEventLog]
TRANSFORMS-set=setnull

transforms.conf
[setnull]
REGEX = (?m)(4624<\/EventID>).+(NtLmSsp\s+<\/Data>)
DEST_KEY = queue
FORMAT = nullQueue

  • Other REGEX used unsuccessfully: REGEX = (?m)EventCode\s*=\s*4624.?LogonProcessName\s=\s*NtLmSsp\s REGEX = (?m)LogonProcessName=(NtLmSsp) REGEX = (?m)^EventCode=(4624).+(LogonProcessName=NtLmSsp)

Thank you very much in advance.
[]s

0 Karma

jfeitosa_real
Path Finder

Unfortunately it did not work the regex you passed.

[setnull]
REGEX = \4624<\/EventID>.+\NtLmSsp|\NtLmSsp.+\4624<\/EventID>
DEST_KEY = queue
FORMAT = nullQueue

I tried it another way, but it did not work either.

Thank you!

0 Karma

jconger
Splunk Employee
Splunk Employee

I notice in your example event the XML syntax is wrong:

<EventID>4624/EventID>

It should be:

<EventID>4624</EventID>

Correcting that, the following regex seems to work:

\<EventID\>4624\<\/EventID>.+\<Data\s+Name='LogonProcessName'>NtLmSsp|\<Data\s+Name='LogonProcessName'>NtLmSsp.+\<EventID\>4624\<\/EventID>

This accounts for EventID occurring before or after the NtLmSsp LogonProcessName

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Think Like an Architect: Introducing the Splunk Certified Cybersecurity Defense ...

In cybersecurity, defenders respond to threats. Architects design the systems that stop them.    As ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...