Splunk Search

Lookup could not display field value that is null

LeeZeeYuen
New Member

I have a field called "ipexist" in the dataset that have two values; empty(Which is defaulted as null in Splunk) and a string value.

I want to use lookup command to obtain two other fields but strangely some events that have null value for ipexist could not display the said two other fields. Below is the sample event with the said fields.
alt text

Above the image you can see the top event does not have "severity" and "severity_level" field but the two below have it. I would like to know how to still display the fields despite having a null value for "ipexist"

Edit;
Updated image since the first screenshot had some issues alt text

Update;
I forgot to mention that some events do not have the value "source_IP". The field "ipexist" uses "source_IP" as its value,

Tags (1)
0 Karma

493669
Super Champion

firstly we have made null 'ipexist' values into source_IP1 in both index as well as in lookup. and now we have join so it will join correctly and then we just change source_IP1 as source_IP while displaying....so i dont think it will give wrong output..

0 Karma

LeeZeeYuen
New Member

Ahhhh, I get it now. Haha sorry kinda slow had to googled what eval if statement does. Yeah the logic makes sense but apparently it is not displaying any of the field in the events

https://imgur.com/a/zctvw

0 Karma

493669
Super Champion
index="printerlinuxlog"|eval ipexist=if(isnull(ipexist),"source_IP1",ipexist)|stats count by ipexist

Does this gives all ipexist field contain either source_IP1 or source_IP value?

0 Karma

LeeZeeYuen
New Member

Yes it does, the count match up to the total events
https://imgur.com/a/5IfRM

0 Karma

493669
Super Champion

ok ..now check for lookup count :

| inputlookup hp_message |stats count by ipexist
0 Karma

LeeZeeYuen
New Member

Here you go! It could only count source_IP that is contained in the lookup table
https://imgur.com/a/Ql0Jq

0 Karma

493669
Super Champion

but lookup has null 'ipexist' present which we have converted into source_IP1 but I am not able to see there

0 Karma

LeeZeeYuen
New Member

If I were to use the eval command you suggested, it would replace the the lookup's ipexist field for all the null value
https://imgur.com/a/Khu7p

0 Karma

493669
Super Champion

Now if you run :
| inputlookup hp_message |eval ipexist=if(isnull(ipexist),"source_IP1",ipexist)|outputlookup hp_message
it will store back to lookup.
then you should be able to join with outcome message and ipexist to get the output..
also I am assuming there is no null value in outcome and message field

0 Karma

493669
Super Champion

or do you want to replace severity_level and severity from lookup?

0 Karma

LeeZeeYuen
New Member

The OUTPUT was just trying to rename them. The values for the two fields will remain as it is from the dataset.

0 Karma

nabeel652
Builder
<snip> | fillnull ipexist value=unknown | lookup yourlookup ipexits output yourfields | </snip>

Hope this would work.

0 Karma

LeeZeeYuen
New Member

I tried using fillnull before on "ipexist" but it would not display the other two output-ed lookup field

0 Karma

DalJeanis
Legend

probably the most direct way to deal with it would be to do something like this before your lookup...

| eval ipexist=coalesce(ipexist,"")

... and set up the lookup table itself to have a blank instead of a NULL.

0 Karma

LeeZeeYuen
New Member

Thank you for the suggestion but I tried it and it didn't work. The lookup table have blank value which Splunk comprehend it as italic null. The event would not display the the two output-ed fields. However, it did declare the null value of "ipexist" as blank.

This is the command used
alt text

The results:
alt text
Image shown that it display "ipexist=" but no signs of "severity" and "severity_level".

Thanks for the help!

0 Karma

niketn
Legend

@LeeZeeYuen, I think you would need to post your screenshot again for the community to help. You can upload to image sharing site and then add the link using image button while posting your comment/update to question.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

LeeZeeYuen
New Member

Ah sorry I didn't know the screenshot wasn't working. Thanks for the heads up!

0 Karma

p_gurav
Champion

Hi LeeZeeYuen,

Are you using ipexist field for mapping in lookup?

0 Karma

LeeZeeYuen
New Member

Yes the command used for lookup is

index="printerlinuxlog"
| lookup hp_message outcome as outcome message as message ipexist as ipexist OUTPUT siem_severity as severity_level syslog_severity as severity

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...