Splunk Dev

Regex for field ending with $

cr32003
New Member

I am trying to filter out WMI events that have the 'User' field whicxh ends with a $ i.e a special character as far as regex is concerned.I am running Splunk version 4.2.2 on a windows 2003 server (virtualised).
my 'local' 'props.conf' is set to:-

[WMI:WinEventLog:Security]
TRANSFORMS-wmi=wmiExcludeUsers

[WMI:WinEventLog:Security]
TRANSFORMS-wmi=wmiExcludeEventCodes

and my 'local' 'transforms.conf' is set to:-

[wmiExcludeEventCodes]
REGEX=(?m)^EventCode=(512|513|514|515)
DEST_KEY=queue
FORMAT=nullQueue 

[wmiExcludeUsers]
REGEX=(?m)^User=\$$
DEST_KEY=queue
FORMAT=nullQueue 

I am fairly sure that the EventCodes bit is working but the Users bit is not.

0 Karma

cr32003
New Member

I have now tried pretty much all of the conbinations, including the one(s) above BUT if i put in the EventCode REGEX all is Hunky Dory and ANY changes made to the EventCode numbers are reflected in the indexing.
However if I then remove the EventCode REGEX and insert the User REGEX (either your version above or my original version) into the SAME TRANSFORMS Stanza then Splunk in its wisdom still indexes all of the events with the User field ending in '$'.
The MOST annoying thing is that if I do the following search:-
source="WMI:WinEventLog:Security" | regex User="\$$"
Then the results are all events with the User field ending in '$'.
Is there any 'debugging' tools to see what Splunk is actually doing when it receives the event and makes the decision as to whether to either index it or not?

0 Karma

MHibbin
Influencer

How abut something like this... I don't think you need to have two stanzas in the props.conf as they are the same sourcetype (have you checked the sourcetype is correct in Splunk?).

[WMI:WinEventLog:Security]
TRANSFORMS-wmievents = wmieventsnull 
TRANSFORMS-wmiusers = wmiusersnull

[wmieventsnull] 
REGEX = (?m)^User=(.*\$) 
DEST_KEY = queue 
FORMAT = nullQueue

[wmiexcludenull] 
REGEX = (?m)^EventCode=(512|513|514|515) 
DEST_KEY = queue 
FORMAT = nullQueue

(Thanks to Ayn for correction!)

0 Karma

MHibbin
Influencer

Ah ok, I wasn't sure, because you can have a transforms like...

TRANSFORMS-wmi = wmievents, wmiusers

Can't you?

0 Karma

Ayn
Legend

The TRANSFORMS sections should have a unique identifier, so for instance TRANSFORMS-wmievents and TRANSFORMS-wmiusers.

0 Karma

MHibbin
Influencer

Why don't you replace the "$$" with ".*\$" This should take anything up to $.

0 Karma

cr32003
New Member

Sorry the copy/paste bit obviuosly did not work correctly
the regex should read 'REGEX=(?m)^User=\$$' which i thought should be any "user value ending in '$'". I have tried changing this to what you suggested and it still has no affect.

0 Karma
Get Updates on the Splunk Community!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...