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.

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...