Splunk Search

Percentage Timechart

tkwaller
Builder

Hello

I'm trying to add a percentage for each day. Here is what I have:

index=tt OrderIntegration.asmx "PlaceOrderResponse" ("RealTime" OR "AdvancedSale") | timechart span=1d count(eval(searchmatch("RealTime"))) as NumberofRealTimeListings, count(eval(searchmatch("AdvancedSale"))) as NumberofNonRealTimeListings, sum(eval("NumberofNonRealTimeListings"/"NumberofRealTimeListings")) as Percent 

Any ideas what I'm missing?

Tags (2)
0 Karma
1 Solution

gfuente
Motivator

Hello

Have you tried to eval the percentage after the timechart, like:

index=tt OrderIntegration.asmx "PlaceOrderResponse" ("RealTime" OR "AdvancedSale") | timechart span=1d count(eval(searchmatch("RealTime"))) as NumberofRealTimeListings, count(eval(searchmatch("AdvancedSale"))) as NumberofNonRealTimeListings | eval Percent = (NumberofNonRealTimeListings/NumberofRealTimeListings)*100

Regards

View solution in original post

gfuente
Motivator

Hello

Have you tried to eval the percentage after the timechart, like:

index=tt OrderIntegration.asmx "PlaceOrderResponse" ("RealTime" OR "AdvancedSale") | timechart span=1d count(eval(searchmatch("RealTime"))) as NumberofRealTimeListings, count(eval(searchmatch("AdvancedSale"))) as NumberofNonRealTimeListings | eval Percent = (NumberofNonRealTimeListings/NumberofRealTimeListings)*100

Regards

chandusubash
New Member

How can I use this percentage and plot it in a timechart ? Can someone help.

0 Karma

tkwaller
Builder

I actually got that after I added that comment. Thanks for the direction!

0 Karma

tkwaller
Builder

Yes when I did this I got "Error in 'eval' command: Typechecking failed. '/' only takes numbers."

0 Karma

gfuente
Motivator

You are right! edited the answer

0 Karma

kristian_kolb
Ultra Champion

also, I think you should remove the double quotes around the field names in the eval.

Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...