Splunk Search

Calculate Percentage Difference Between Two Searches

albyva
Communicator

When running a single search on bandwidth data I can calculate the percentage between bandwidth In and Out using this eval fucntion:

| eval percent_difference=((BandwidthIn/BandwidthOut)*100) | table percent_difference _time

What I want to do is calculate the percentage change between bandwidth over a 5/minute time span. For example, lets assume I'm seeing 100/mbps of bandwidth at 12:00p Noon and at 12:05p the bandwidth jumps to 125/mbps. How can I calculate the 25% increase in bandwidth between those two timespans/searches?

Tags (2)
0 Karma

albyva
Communicator

Wonderful. Thanks for the | bucket command tip.

0 Karma

aholzer
Motivator

Like @linu1988 points out, you can use the bucket command to get the values for every 5 mins, then you can use the delta command to calculate the difference between two adjacent events.

Your search would look like:
| bucket _time span=5m| eval percent_difference=((BandwidthIn/BandwidthOut)*100) | delta percent_difference as delta_percent | table _time, percent_difference, delta_percent

Here's the documentation on delta: http://docs.splunk.com/Documentation/Splunk/5.0.3/SearchReference/Delta

0 Karma

linu1988
Champion

Could you please give the below query a try:

|bucket _time span=5m| eval percent_difference=((BandwidthIn/BandwidthOut)*100) | table percent_difference ,_time

Thanks

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Get Agentic with Splunk Lantern: Connect to Cisco Cloud Control, Transform ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

July Community Events: Master ITSI 5.0 & Automate Splunk

Struggling with alert fatigue or feeling like you're spending more time on infrastructure maintenance than ...

New Release of Federated Search: Bringing Splunk Analytics to More of Your Data

Organizations today are generating more data than ever and storing it across cloud object stores, data lakes, ...