Splunk Search

Eval Comparision shows no matches despite both fields having same values

neerajs_81
Builder

Hi All, 
I need to filter my search based on the condition if the values of 2 fields are equal or not.  The 2 fields in question are actor.alernateID  and src_user_email and both fields are visible in the same event.

For example:  Raw data shows value of actor.alternateID is   anand.pandey@company.com

 

neerajs_81_0-1648619765791.png

Likewise, Raw data shows value or src_user_email is also same:  anand.pandey@company.com

neerajs_81_1-1648619923583.png

If i run the following search,  the value of the field match  comes out to be "No match" .  Why is eval showing them to be not a match if both field values are the same ? 

 

 

index=xxx sourcetype=xxxx 
....
| eval match=if(actor.alternateId=src_user_email,"Match","No Match")

 

 

 

neerajs_81_3-1648620163158.png

Likewise, instead  if i  use the where condition instead of eval  ,  this shows NO results to display;   meaning  even the where clause thinks both fields are different .  

 

 

|where src_user_email = actor.alternateID

 

 

The same is happening for other email IDs and other fields even though their values are same.

What am i doing wrong here? How to compare fields then?  Both are strings.

Labels (1)
Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @neerajs_81,

I suppose that you already checked if there's a space at the beginning or the eand of both values.

Anyway, please rename the field with dot and try again:

index=xxx sourcetype=xxxx 
....
| rename actor.alternateId AS alternateId
| eval match=if(alternateId=src_user_email,"Match","No Match")

sometimes dot gives problem in eval command.

Ciao.,

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @neerajs_81,

I suppose that you already checked if there's a space at the beginning or the eand of both values.

Anyway, please rename the field with dot and try again:

index=xxx sourcetype=xxxx 
....
| rename actor.alternateId AS alternateId
| eval match=if(alternateId=src_user_email,"Match","No Match")

sometimes dot gives problem in eval command.

Ciao.,

Giuseppe

neerajs_81
Builder

Holly Molly 🙂  Just when i was going thru your other post , you replied to my question.
https://community.splunk.com/t5/Splunk-Search/comparing-fields-to-find-identical-values/m-p/533089 

Thank you so much that worked.  😀  

Now is the . dot in the field name  an issue with  |search  and |where  clause  also ?  Because i did try comparing using both search and where  in additional to eval  as you mentioned in the other post and both didn't work.  Do i need to rename the field if comparing via  |search and |where as well ?

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @neerajs_81,

I'm not sure about all the situations where dot gives problem, I'm sure about eval!

But anyway, I always rename eventual fields with dot or parenthesis or spaces or other strange chars.

Ciao.

Giuseppe

Get Updates on the Splunk Community!

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...