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!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...