Knowledge Management

Why is splunk field not populated with value from a lookup file?

cbr654
Path Finder

(1)  index=blah  Product IN (Cuteftp,Filezilla)
(2)  | rex field=Image "(?<values_Image>[^\\\\]+$)"
(3)  | lookup test.csv Image as values_Image OUTPUT Image
(4)  | eval match=if(values_Image == Image, "yes", "no")
| table _time Product Company Description ImageLoaded Image values_Image match

(1) I am searching index=blah  where "Product" = Cuteftp or Filezilla

(2) From my results I am removing everything before the last backslash, and the new field  is going to be  called "values_Image" 

(3) I am checking the "Image" column  in the lookup file (test.csv) to see if it matches "values_Image" from my Splunk results

(4) If there is a match, then I see "yes" in the match column in Splunk. If there is no match I see a "no"

The problem I have:
When match =yes the Image field in Splunk  is populated with the value from the Image field in the lookup file (test.csv) . This is good

When match=no  the  Image field in Splunk is not populated with the value from the the Image field in the lookup file (test.csv) . This is my problem




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

richgalloway
SplunkTrust
SplunkTrust

If there is no match in the lookup file then Splunk doesn't know what to return so it returns nothing (null).

What problem are you trying to solve?

---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

What you describe is normal.  If values_Image is not found in the lookup file then the Image field will be null.  Since values_Image=null is false, match is set to "no".

What value are you expecting to get from the lookup file?

---
If this reply helps you, Karma would be appreciated.

cbr654
Path Finder

I have the lookup file populated with metadata in all the fields.  When "values_Image" is not found in the lookup I was hoping to see the entry I have in "Images" in the lookup file even though it does not match. My goals was to view the mis-match when match is set to "no"  Is this possible? Thanks you 

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

If there is no match in the lookup file then Splunk doesn't know what to return so it returns nothing (null).

What problem are you trying to solve?

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Everything Community at .conf24!

You may have seen mention of the .conf Community Zone 'round these parts and found yourself wondering what ...

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...