Splunk Search

How to fill the gaps from days with no data in tstats + timechart query?

Neel881
Path Finder

Hello,

How to fill the gaps from days with no data in tstats + timechart query?

Query:

| tstats count as Total where index="abc"  by _time, Type span=1d

Getting:

Neel881_0-1695132638207.png

Required:

Neel881_1-1695132682156.png

 

Please suggest

 

Thank You

 

0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| tstats count as Total where index="abc"  by _time, Type span=1d
| timechart span=1d max(Total) as Total by Type
| untable _time Type Total

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Try this.  The timechart command should fill in empty time slots automatically.

| tstats prestats=true count as Total where index="abc"  by _time, Type span=1d
| timechart span=1d cont=true count as Total by Type

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

Neel881
Path Finder

Same output

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try with fillnull

| tstats count as Total where index="abc"  by _time, Type span=1d
| timechart span=1d max(Total) as Total by Type
| fillnull value=0
| untable _time Type Total

Neel881
Path Finder

Fillnull works properly in my case. Thank you!

 

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| tstats count as Total where index="abc"  by _time, Type span=1d
| timechart span=1d max(Total) as Total by Type
| untable _time Type Total

Neel881
Path Finder

Thank you, Now I am getting correct output but Phase data is missing.

| tstats count as Total where index="abc"  by _time, Type, Phase span=1d
| timechart span=1d max(Total) as Total by Type
| untable _time Type Total

 Phase field is missing in the final table.

I tried to add 'Phase' field in the untable but showing error.

 

Pls suggest

0 Karma

Neel881
Path Finder

Got the solution. Thank you so much.

0 Karma
Get Updates on the Splunk Community!

Notification Email Migration Announcement

The Notification Team is migrating our email service provider from Postmark to AWS Simple Email Service (SES) ...

Mastering Synthetic Browser Testing: Pro Tips to Keep Your Web App Running Smoothly

To start, if you're new to synthetic monitoring, I recommend exploring this synthetic monitoring overview. In ...

Splunk Edge Processor | Popular Use Cases to Get Started with Edge Processor

Splunk Edge Processor offers more efficient, flexible data transformation – helping you reduce noise, control ...