Splunk Search

How to filter two different actions events based on a common field in both

massumtaqi
New Member

if an action 1 triggers one event of common field=A and action 2 triggers ten events of common field= A, B or C. How do i identify and filter the Acton 1 and 2 separately?

Tags (1)
0 Karma

woodcock
Esteemed Legend

Like this (or similar):

((index="YouShouldAlwaysSpecifyAnIndex" AND sourcetype="AndSourcetypeToo") OR (index="YouShouldAlwaysSpecifyOtherIndex" AND sourcetype="AndOtherSourcetypeToo")) AND Logon_Type="*"
| stats latest(_raw) AS _raw count dc(sourcetype) AS sourcetypeCount BY host
| where count>1 OR sourcetypeCount>1
0 Karma

massumtaqi
New Member
EventCode=4624
| rex "(?ms)Logon Type:...(?<Logon_Type>\w+)"
| rex "(?ms)New Logon:\s+Security ID:..(?<Login_Security_ID>[AEW]+.\w+.\w+)"
| where (like (Login_Security_ID,"%mtaqi.a%"))
| where Logon_GUID!="{00000000-0000-0000-0000-000000000000}"

This is my code above that shows all 13 events for both actions . what do i do to see only event 1 of logon_type 3 caused by first action ?

The code you provided also show all 13 events

0 Karma

woodcock
Esteemed Legend

Show sample events and mockup of desired final output.

0 Karma

massumtaqi
New Member

Action one triggers 1 event :

Logon_Type
3
_time
2019-05-10T14:38:12.000-0400

Action two triggers 12 concurrent events :

Logon_Type
3
3
3
3
3
3
3
3
3
3
10
3

_time
2019-05-10T14:32:13.000-0400
2019-05-10T14:32:12.000-0400
2019-05-10T14:32:12.000-0400
2019-05-10T14:32:12.000-0400
2019-05-10T14:32:12.000-0400
2019-05-10T14:32:12.000-0400
2019-05-10T14:32:12.000-0400
2019-05-10T14:32:12.000-0400
2019-05-10T14:32:11.000-0400
2019-05-10T14:32:11.000-0400
2019-05-10T14:32:10.000-0400

I want to see first one only

0 Karma

woodcock
Esteemed Legend

First of all, your sample events don't make sense: your "first event" has a timestamp after all of the other events that "it caused" and your 12 events only have 11 timestamps listed (worst of all, the one that is not there is the most important one, the one that you desire). You should install the Windows TA so that your field extractions are automatic. I say this all the time: sow us your sample events (you were close but not all the way there), and a mockup of your desired final output. Then we can help.

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...