Splunk Search

How to display percentage of items passed over each week

wjmaxwe2
New Member

SOURCE CODE | eventstats count(eval(errorCount=0)) AS passed, count(shortVIN) AS total | timechart span=1w@w0 eval((passed/total)*100) AS percentPassed

 

I get a message saying "expression has no fields" on the timechart. I am unsure which expression to use to display week 1's percentage, then week 2's percentage, and so on. 

 

Any help is appreciated

Labels (4)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

I think this should work for you

| timechart span=1w@w0 count(eval(errorCount=0)) AS passed count(shortVIN) AS total
| eval PercentPassed=round(passed/total*100,2)

 You count the weekly values in the timechart command and then calculate the percentage after the timechart is done.

 

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...