Splunk Search

Track Changes to a field

akselsoeb
Engager

Hello guys

I need some help with making a table/dashboard that shows me changes to incidents in our Defender platform.
The underlying issue that we see is that Defender sometimes, when an incident is handled by automation, de-escalate the severity of a particular incident.

So in my index of incidents i want to track for each specific incident that is handled by automation to show me when the severity field changes. 

The table should look something link this.

IncidentId       Description       Status    Old_Severity     New_Severity


I don't know whether to use the streamstats or the dedup command. I've been fiddling abit with both but can't seem to get the right output.

Anyways, hope you can help me out here. If theres something unclear about my question, let me know so i can clarify.

Labels (1)
0 Karma
1 Solution

dtburrows3
Builder

So if you just want to narrow down on the IncidentIds that this occurred on, I thing doing a stats aggregation would be more efficient. Something like this.

<base_search>
    | fields + _time, IncidentId, Description, Status, Severity
    | sort 0 +_time
    | stats
        values(Description) as Description,
        latest(Status) as Status,
        dc(Severity) as dc_severity,
        list(Severity) as Sequence_Severity,
        earliest(Severity) as Old_Severity,
        latest(Severity) as New_Severity
            by IncidentId
    | where 'dc_severity'>1
    | fields - dc_severity

 
If you want to retain all of the original events apart of any IncidentId that this occurred on then you could use some sort of combo of streamstats and eventstats (less efficient but more detailed)

<base_search>
    | fields + _time, IncidentId, Description, Status, Severity
    | sort 0 +IncidentId, -_time
    | streamstats window=2
        earliest(Severity) as Old_Severity,
        latest(Severity) as New_Severity
            by IncidentId
    | eventstats
        max(eval(if(NOT 'Old_Severity'=='New_Severity', 1, 0))) as status_change
            by IncidentId
    | where 'status_change'>0
    | fields - status_change

View solution in original post

0 Karma

dtburrows3
Builder

So if you just want to narrow down on the IncidentIds that this occurred on, I thing doing a stats aggregation would be more efficient. Something like this.

<base_search>
    | fields + _time, IncidentId, Description, Status, Severity
    | sort 0 +_time
    | stats
        values(Description) as Description,
        latest(Status) as Status,
        dc(Severity) as dc_severity,
        list(Severity) as Sequence_Severity,
        earliest(Severity) as Old_Severity,
        latest(Severity) as New_Severity
            by IncidentId
    | where 'dc_severity'>1
    | fields - dc_severity

 
If you want to retain all of the original events apart of any IncidentId that this occurred on then you could use some sort of combo of streamstats and eventstats (less efficient but more detailed)

<base_search>
    | fields + _time, IncidentId, Description, Status, Severity
    | sort 0 +IncidentId, -_time
    | streamstats window=2
        earliest(Severity) as Old_Severity,
        latest(Severity) as New_Severity
            by IncidentId
    | eventstats
        max(eval(if(NOT 'Old_Severity'=='New_Severity', 1, 0))) as status_change
            by IncidentId
    | where 'status_change'>0
    | fields - status_change
0 Karma

akselsoeb
Engager

Thank you @dtburrows3 
This was exactly what i was looking for.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...