Alerting

Setup an alert if field A count is less than 10 percent of field B ?

iamsplunker
Communicator

Hi All, 

I've a search which has multiple columns, I would like to setup an alert If field A values are less than 10% of field B

Here are my values

_time          field A    field B

11:00          100        120

11:15           200        130

11:30           300         450

11:45           400         450

Labels (1)
0 Karma

shivanshu1593
Builder

You can try something like this.

| your base search..

| eval difference = abs("field A" - "field B") `comment("Calculates the difference between your two fields. Abs converts the number into an absolute value,if it's negative. Ex abs(100-120)= 20")`

| eval base = ("field A" + "field B") / 2 `comment("We'll use the base to divide the difference")`

| eval percentage_difference = (difference/base) * 100 `comment("Calculates the percentage of difference between the numbers in your fields")`

| where percentage_difference <10 `comment("Detects the values of field a and field b, whose difference is less than 10%")`

| table _time "field A" "field B" percentage_difference

Save this as an alert and you're good to go. Let me know how it goes.

Thank you,

S

** If the answer helps you. Please mark it as accepted, so that it could help the future readers. **

Thank you,
Shiv
###If you found the answer helpful, kindly consider upvoting/accepting it as the answer as it helps other Splunkers find the solutions to similar issues###
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Create a new field to evaluate when field A is less than 10 percent of field B

| eval lessthan10=if(fieldA * 10 < fieldB, 1, null())

Set your alert based on the presence of lessthan10 e.g. search lessthan10 

0 Karma
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!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...