Splunk Search

Why is Splunk gathering latest data even with Null values?

jadengoho
Builder

How can i get latest value of all ID (1-1,1-2,2-1,2-2). considering there are no latest data on ID(2-1,2-2)

Data:

12:10:01 ID 1-1, value="GOOD"
12:10:01 ID 1-2, value="GOOD"
12:10:02 ID 2-1, value="GOOD"
12:10:02 ID 2-2, value="GOOD"

12:10:03 ID 1-1, value="GOOD"
12:10:03 ID 1-2, value="GOOD"
12:10:04 ID 2-1, value="GOOD"
12:10:04 ID 2-2, value="GOOD"

12:10:05 ID 1-1, value="GOOD"
12:10:05 ID 1-2, value="GOOD"
12:10:06 ID 2-1, value="GOOD"
12:10:06 ID 2-2, value="GOOD"

12:10:07 ID 1-1, value="GOOD"
12:10:07 ID 1-2, value="GOOD"

12:10:08 ID 1-1, value="GOOD"
12:10:08 ID 1-2, value="GOOD"

alt text

0 Karma

goodair
New Member

I'm assuming your fields are extracted properly, so that "ID" and "value" are both extracted. You can retrieve the last value for each ID using the stats command latest:

[Your search string to find the events] | stats latest(value) by ID

This will give you a table of IDs and the latest value field for each. You can read more about stats here:
https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Stats

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...