Splunk Search

How to write a search to fill in missing data with the last seen value?

nivek000
New Member

Suppose a search returns the following data:

_time Key Value
10:30:00 Key1 8
10:30:00 Key2 50
10:31:00 Key2 100
10:35:00 Key1 9
10:36:00 Key2 200

I would like to apply a Splunk command to fill in the missing values (by the minute) with the last seen value. So, the results would look like (filled in results in italics):

_time Key Value
10:30:00 Key1 8
10:30:00 Key2 50
10:31:00 Key1 8 *
10:31:00 Key2 100
*10:32:00 Key1 8 *
*10:32:00 Key2 100 *
*10:33:00 Key1 8 *
*10:33:00 Key2 100 *
*10:34:00 Key1 8 *
*10:34:00 Key2 100 *
10:35:00 Key1 9
*10:35:00 Key2 100 *
*10:36:00 Key1 9

10:36:00 Key2 200

Note that I can achieve this for search results that contain only one of the keys using timechart and filldown. I cannot see how it can operate on segments of the data independently (by key). The "by" keyword for timechart does not behave like the "by" keyword in stats (a "group by" function).

0 Karma

sundareshr
Legend

See if this works

... | bin span=15m _time | stats last(value) as value by _time key | filldown value | xyseries _time key value
0 Karma

nivek000
New Member

I do not believe this will work because neither bin nor stats adds rows for missing time entries. This is why I was trying timechart which will provide an entry for every minute even if there is not data - then filldown adds the missing values. But I do not know how to get timechart to do a stats-like "group by" so that the missing times and values are filled in independently for each key.

0 Karma

sundareshr
Legend

You're right. You could try the untable command...

... | timechart values(value) as v  by key | untable _time key v | filldown v | xyseries _time key v 
0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...