Splunk Search

Remove rows without result from timechart count query

jam00
Explorer

Hello,
I have the following query:
sourcetype=access_* action="purchase"
| timechart count by productName usenull=f useother=f

And I get a timechart with zeros: https://imgur.com/a/XWdbIZH

Do you know a way to remove that rows with zeros? Is it possible to reference timechart "count" as a variable to use it with "where" command: | where $count$ > 0 , or something like that?

Thanks in advance

0 Karma
1 Solution

niketn
Legend

@jam00 you should try timechart option cont=f, the rows with all zeros will be removed.

sourcetype=access_* action="purchase" 
| timechart count by productName cont=f usenull=f useother=f

Refer to documentation: https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Timechart#Optional_arguments

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

niketn
Legend

@jam00 you should try timechart option cont=f, the rows with all zeros will be removed.

sourcetype=access_* action="purchase" 
| timechart count by productName cont=f usenull=f useother=f

Refer to documentation: https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Timechart#Optional_arguments

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

jam00
Explorer

@niketnilay I hadn't considered that argument. Thank you so much.

Get Updates on the Splunk Community!

Operationalizing TDIR: Building a More Resilient, Scalable SOC

Optimizing SOC workflows with a unified, risk-based approach to Threat Detection, Investigation, and Response ...

Pro Tips for First-Time .conf Attendees: Advice from SplunkTrust

Heading to your first .Conf? You’re in for an unforgettable ride — learning, networking, swag collecting, ...

Raise Your Skills at the .conf25 Builder Bar: Your Splunk Developer Destination

Calling all Splunk developers, custom SPL builders, dashboarders, and Splunkbase app creators – the Builder ...