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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...