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!

Improve Delivery Assurance with S2S ACK for Edge Processor

Edge Processor helps Splunk customers process data closer to the source: filtering, transforming, masking, and ...

.conf26 Platform Sessions: Turn Machine Data into Agentic Action

As autonomous agents and multi-cloud architectures reshape modern IT, data platforms have to do far more than ...

Introducing the Launch of Edge Processor in Hybrid Mode!

Modernize Data Ingestion Without Starting Over  For years, organizations have relied on Splunk's proven ...