Splunk Enterprise Security

Want help in creating Splunk Query with specific conditions?

joomla
Engager

Hi Splunk Members,

Good Day!

I am looking for support to create a query with Windows Security Events Logs. Basically the idea is to search for different Windows Security Event IDs events within a short span by Account Name.

Example: To return events if events id: XXXX occurs at 1 PM EST then within 1 min i.e 1:01 PM; Event ID: YYYY occurs and then event id: ZZZZ also occurs for same Account_Name then my query should results all those events.

Kindly note, condition should met if all three event ids trigger within short span that is 1 min here. If for an example Event ID XXXX occurs but Event IDs YYYY and ZZZZ do not for the same Account Name then results should be zero in the ouput.

Many Thanks.

 

 

 

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
``` your search ```
| table _time user event 
``` reverse so we can get row number in ascending order ```
| reverse
| streamstats count as row
``` capture time for each event type ```
| eval XXXXTime=if(event="XXXX",_time,null) 
| eval YYYYTime=if(event="YYYY",_time,null)
| eval ZZZZTime=if(event="ZZZZ",_time,null)
``` capture row for each event type ```
| eval XXXXRow=if(event="XXXX",row,null) 
| eval YYYYRow=if(event="YYYY",row,null) 
| eval ZZZZRow=if(event="ZZZZ",row,null) 
``` track latest time and row for each event type by user ```
| streamstats latest(XXXXTime) as lastXXXX latest(YYYYTime) as lastYYYY latest(ZZZZTime) as lastZZZZ max(XXXXRow) as lastXXXXRow max(YYYYRow) as lastYYYYRow max(ZZZZRow) as lastZZZZRow by user
``` filter for events in XXXX, YYYY, ZZZZ order where ZZZZ is within 60 seconds of last XXXX ```
| where lastXXXXRow < lastYYYYRow AND lastYYYYRow < lastZZZZRow AND lastZZZZ < lastXXXX + 60
0 Karma

alonsocaio
Contributor

Hi @joomla 

I guess you could reach this result by using transaction command. I have tried this way and It seems to work for your use case:

...YOUR SEARCH QUERY...
| transaction Account_Name startswith=eval(EventCode=XXXX) endswith=eval(EventCode=ZZZZ) maxspan=1m
| search EventCode=YYYY

 

0 Karma
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 ...