Splunk Search

How do I return all events whether they're in Lookup table or not?

jwalzerpitt
Influencer

I have the following search:

index="foo" EventCode=*
| lookup windows_signatures.csv signature_id AS EventCode OUTPUT signature
| stats count by EventCode, signature

How do I see the events related to the field EventCode that doesn't have a corresponding signature in the lookup file?

I currently see the following:

EventCode signature                                                     count   
4624        An account was successfully logged on   259296
4634        An account was logged off                           255921
4672       Special privileges assigned to new logon     251320

but I want to see all EventCode events whether they have a signature field or not:

EventCode signature                                                     count   
4624        An account was successfully logged on   259296
4634        An account was logged off                           255921
6                                                                                              254891
4672       Special privileges assigned to new logon     251320

Thx

1 Solution

danwilson
Explorer

lookup shouldn't reduce the number of events, but rather it should leave some null valued fields, which won't be counted in your stats command.

You can use fillnull to give default the null fields a default value.

index="foo" EventCode=*
| lookup windows_signatures.csv signature_id AS EventCode OUTPUT signature
| fillnull value=null signature
| stats count by EventCode, signature

View solution in original post

danwilson
Explorer

lookup shouldn't reduce the number of events, but rather it should leave some null valued fields, which won't be counted in your stats command.

You can use fillnull to give default the null fields a default value.

index="foo" EventCode=*
| lookup windows_signatures.csv signature_id AS EventCode OUTPUT signature
| fillnull value=null signature
| stats count by EventCode, signature

jwalzerpitt
Influencer

Thx - that worked perfectly!

0 Karma

493669
Super Champion

Try This:

 index="foo" EventCode=*|join type=left EventCode[|inputlookup windows_signatures.csv|rename signature_id as "EventCode"|table EventCode, signature]|| stats count by EventCode, signature
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...