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!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...