Splunk Search

How to use timechart to display whether a log exists or not over a certain time range in 15 minute buckets?

JohnCM8181
New Member

I am trying to write a search that displays a table that shows whether a log in cloud watch exists or not every 15 minutes over a 5 hour period. The caveat being that I would like it to show a 0 for time intervals that don’t have the log even if they’re in the future. I’m also having trouble formatting the result table so that the time intervals are the columns/x axis and the count is row/y-axis.

Any help would be greatly appreciated, thanks!

Labels (5)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

Assuming that you are using line chart, and you want the value to be 1 when log exists and 0 when there is no log during the bucket, something like this will do

| tstats count where source=cloud_log earliest=-3h latest=+2h by _time span=15m
| timechart sum(eval(if(count > 0, 1, 0))) as has_log
| fillnull value=0

If you only want to display line on the zero axis and don't care how the column look like, you can skip fillnull, just set visualization to touch zero.

 

0 Karma
Get Updates on the Splunk Community!

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 ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...