Splunk Search

Query that checks if field values have changed to exclude events

Splunkie
Explorer

Hi Friends,

I am working a query that checks if the value of a field has changed to a state of resolved to exclude it from the results of active cases.

The field I am trying to use to check if a case has been resold is the status field.  I need help with a query that looks at all cases with the status of Active and removes cases whose status has now changed to Resolved from the results.

Thank you.

Labels (1)
Tags (1)
0 Karma

splunkmarroko
Engager

try this:
base search   ``` index=xyz sourcetype=abc```
| where status!=resolved  ```if you already have the "resolved field", if not consider extracting that field.

0 Karma

Splunkie
Explorer

Thanks @splunkmarroko,

Thanks. I tried that, however going about it that way returns the initial events with an "Active" status and does not take into consideration that the status has changed from "Active" to "Resolved".

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @Splunkie 

To exclude cases that have transitioned to "Resolved" and only show currently active cases, find the latest status per case and filter where that status is "Active".

| your_search_here
| stats latest(status) as latest_status by case_id
| where latest_status="Active"

stats latest(status) by case_id groups events by case and finds the most recent status update per case

where latest_status="Active" filters to only cases whose latest status is still "Active"

This effectively excludes cases that have been resolved or closed later

Replace case_id with your actual case identifier field

🌟Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

Splunkie
Explorer

Thanks @livehybrid,

This works but returns inaccurate results when the search is run using the real time search time filter. This is an example of what I have;

| base_search here

| stats latest(status) as latest_status by incidentId
| where latest_status!="Resolved"
| stats count as total

 

The output is to count the number of active incidents to be displayed on a dashboard. Any pointer or tips on how to better achieve this will be appreciated.

Cheers.

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!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...