Splunk Search

Yes / No Column if EventCode Found in Lookup

aferone
Builder

I have a lookup table with certain Windows Event Codes.  I am searching our Windows index for all Windows Event Codes.  I would like a count of all Windows Event Codes, per Event Code, and a column that says whether that Event Code is in my lookup table.  This is what I am attempting partly with what I found on Answers, but it isn't working:

 

 

| inputlookup MyWinEvCodes 
| fields EventCode 
| append 
    [ search index=winsevlog 
    | stats count as Count by EventCode
        ] 
| eval Found = if(Count > 1,"Yes","No") 
| stats count by EventCode, Found 
| sort + count

 

Thank you in advance!

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Try this query.

index=winsevlog 
| stats count as Count by EventCode
| fields - count
| lookup MyWinEvCodes EventCode OUTPUT EventCode
| eval Found = if(isnotnull(EventCode),"Yes","No") 
| table EventCode, Found 
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

aferone
Builder

Thanks!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try this query.

index=winsevlog 
| stats count as Count by EventCode
| fields - count
| lookup MyWinEvCodes EventCode OUTPUT EventCode
| eval Found = if(isnotnull(EventCode),"Yes","No") 
| table EventCode, Found 
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...