Splunk Search

values mismatch

akumar
Loves-to-Learn Lots

i have issue where i am comparing values from 2 fields which will have same value always, but sometimes it differs. I want to compare between these two feilds and have  status as Match or Mismatch. I have having issues where even if both fields have some value its showing as mismatch in status. 

| eval CheckMatch = if(f1==f2,"Match", "Mismatch")

Below is the sample result 

f1                       f2               CheckMatch
14552.06   14552.06    Mismatch

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Are the fields of the same type, e.g. both numeric or both strings? Is either one a multivalue field?

0 Karma

akumar
Loves-to-Learn Lots

Both are numeric values only. But before applying this match condition I am adding 2 field of values to F1 ( f1=a+b). 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Is there any rounding going on in the way the numbers are presented? Is it worth trying 

| eval CheckMatch = if(round(f1,2)==round(f2,2),"Match", "Mismatch")
0 Karma

akumar
Loves-to-Learn Lots

I tried using your above command, now it’s matching all fields even if the values are not the same. 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Are they being treated as strings? What do you get with

| eval f1number=tonumber(f1)
| eval f2number=tonumber(f2)
0 Karma

akumar
Loves-to-Learn Lots


please see below is the search I am using and the result set

3761C37E-6D09-45C3-A542-FBD62BFC5777.jpeg

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...