Splunk Search

Using wildcards in splunk lookups, can't match second field

Josh1890
Explorer

Hello, I need help with the following scenario:

Let's say I have a log source with browser traffic data, one of the available fields is malware_signature

I made a lookup table to filter the results by 10 specific malwares I'd like to be alerted on, all 10 entries have wildcards like so, with another field called classification:

malware_signatureclassification
*mimikatz*high

 

when I use inputlookup to filter the results it works well, but no matter what I tried I can't get the "classification" field to be added


works well for filtering:

[| inputlookup malware_list.csv | fields malware_signature]

 

classification field won't show:

[| inputlookup malware_list.csv | fields malware_signature classification]

 

Doesn't work:

[| inputlookup malware_list.csv | fields malware_signature]
| lookup malware_list.csv malware_signature OUTPUT classification

 

 

Clarification:

 I use inputlookup for filtering the results to the logs I want to see by the malware_signature

After that I want to enrich the table with the classification field, but using the lookup command it won't catch the malware_signature with the wildcards.

 

 

 

Labels (2)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

I am confused.  If you want to enrich data with classification, why use inputlookup? Just create a lookup with match_type=WILDCARD(malware_signature) if you haven't. In your third search, I see that you have defined a lookup named malware_list.csv.  If so, you must have missed MATCH_TYPE. (See Create a CSV lookup definition) Then, use lookup command instead of inputlookup.

``` your search that returns malware_signature ```
| lookup malware_list.csv malware_signature
| where isnotnull(classification)

 

0 Karma

Josh1890
Explorer

Hey, yes I use inputlookup for filtering the results to the logs I want to see by the malware_signature

After that I want to enrich the table with the classification field, but using the lookup command it won't catch the malware_signature with the wildcards.

 

0 Karma

yuanliu
SplunkTrust
SplunkTrust

As I said, it only means that you didn't set up wildcard matching correctly.  Check your lookup setup.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Josh1890,

please try this:

<your_search>
[| inputlookup malware_list.csv | rename malware_signature AS query | fields query ]

in thsi way you perform a full text search using themalware_signature field.

Ciao.

Giuseppe

0 Karma

Josh1890
Explorer

Hey Giuseppe,

Will that allow me to add the classification field from the lookup table?

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Josh1890 ,

as also @PickleRick said, it's diefferent to search and to entich, using my solution you search for the patterns contained in your lookup.

If you need to agg the classification, the only way is to use the lookup command.

Ciao.

Giuseppe

0 Karma

Josh1890
Explorer

Hey, yes I use inputlookup for filtering the results to the logs I want to see by the malware_signature

After that I want to enrich the table with the classification field, but using the lookup command it won't catch the malware_signature with the wildcards

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

These are two different things. One thing is generating conditions using subsearch, another thing is enriching you results with a lookup.

Important thing though, generating conditions where search term has a wildcard at the beginning makes no sense performancewise. Splunk still has to read all events from the index and search them one by one. It cannot use indexed structures.

0 Karma

Josh1890
Explorer

You're right, but it'll run every 15 minutes for a limited amount of data, so we can suffer the performance issue

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Yes, but it makes no sense to add another layer of processing since you're gonna go through every event anyway.

So the best approach here would be to do

your basic search
| lookup enriching your data
| filter out data not matching your criteria based on lookup values

 

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...