Splunk Search

Missing data in tstats output

Harish2
Path Finder

Hi All, using below query but not getting complete output.
If there is no data present  for Response time for particular days but values present for Fordresponsetime for same days  it is not showing up in the table

 

|tstats avg(TotalResponseTime) as ResponseTime avg(FordResponseTime) as Fordresponsetime where index=app-index NOT TERM(timeout) by _time

 

QueryOutput:

_timeResponseTimeFordresponsetime
2024-01-0112.6734.00
2024-01-0234.9456.89
2024-01-0324.7852.70
2024-01-0434.7042.87


ExpectedOutput:

_timeResponseTimeFordresponsetime
2024-01-0112.6734.00
2024-01-0234.9456.89
2024-01-0324.7852.70
2024-01-0434.7042.87
2024-01-05033.56
2024-01-06023.77
2024-01-07034.78

 

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The stats family of commands will not fill in the null values created by the absence of data.  The timechart command, however, will do so.  try this

|tstats prestats=t avg(TotalResponseTime) as ResponseTime avg(FordResponseTime) as Fordresponsetime where index=app-index NOT TERM(timeout) by _time
| timechart avg(TotalResponseTime) as ResponseTime avg(FordResponseTime) as Fordresponsetime

The tstats command does the heavy lifting and prepares the results for later processing by another stats command.  The timechart command essentially formats what tstats created and fills in zeroes for missing values.

 

---
If this reply helps you, Karma would be appreciated.
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!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...