Splunk Search

How to pull additional fields from a lookup that is using wildcards?

joeybagofdonuts
Explorer

I'm trying to build a search that will return an event and the severity of that event. I have the events with wildcards for parts that might change and severity in a lookup.

Here's an example from my lookup
Message,Severity
*kernel: nfs: server * OK,normal
*kernel: nfs: server * not responding* still trying,critical

If I run this search I get back the results I'd like, but have no way of referencing this back to the lookup to grab severity because the Message doesn't match whats in the lookup due to the wildcards

index=os source=/var/log/messages host=linuxserver1p | rex field=_raw "(?<Message>.*)"
| search [inputlookup mylookup.csv | table Message]

Jul 28 02:15:40 linuxserverp kernel: nfs: server fixdist OK
Jul
28 01:30:37 linuxserver1p kernel: nfs: server fixdist not responding, still trying

How can I take these results back to my lookup and be able to pull severity out?

Here is another search I've tried where I have both the results I want and the values from the lookup and I just need to join them together somehow, but as far as I can tell the join won't work with wildcards

|inputlookup mylookup.csv |rename Message as msg

| append[search index=os source=/var/log/messages host=linuxserver1p | rex field=_raw "(?<Message>.*)" | search [inputlookup mylookup.csv | table Message]]

|table Message msg Severity


 
 
Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

One can use wildcards in a lookup if one defines the lookup that way.  Go to Settings->Lookups and click on "Lookup definitions".  Add a new definition that references mylookup.csv.  Click the Advanced box and type "WILDCARD(Message)" in the "Match type" box.

Invoke the wildcard lookup with the lookup command (see the Search Reference manual for the difference between lookup and inputlookup).

index=os source=/var/log/messages host=linuxserver1p | rex field=_raw "(?<Message>.*)"
| lookup mylookup Message OUTPUT Severity | table Message Severity
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

One can use wildcards in a lookup if one defines the lookup that way.  Go to Settings->Lookups and click on "Lookup definitions".  Add a new definition that references mylookup.csv.  Click the Advanced box and type "WILDCARD(Message)" in the "Match type" box.

Invoke the wildcard lookup with the lookup command (see the Search Reference manual for the difference between lookup and inputlookup).

index=os source=/var/log/messages host=linuxserver1p | rex field=_raw "(?<Message>.*)"
| lookup mylookup Message OUTPUT Severity | table Message Severity
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

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