Splunk Search

Lookups - How to limit/eliminate multiple matches

chris
Motivator

Hi

We have a automatic csv lookup for a specific source, for the host field.

Some hosts will have the lookup fields added multiple times to an event. We have the impression that this is because the host exists in several rows/lines/records in the csv-File. Most of the fields for all rows are the same. But a hostname can have multiple different aliases and that translates into 1 row per alias with our csv.

Is there a way to tell the lookup to stop after the first match or should I just somehow sanitize my csv?

Thanks Chris

Tags (1)
1 Solution

bwooden
Splunk Employee
Splunk Employee

By default, Splunk will return up to 100 matches for look-ups not involving a time element. You can update it to only return one.

For an automatic look-up, edit transforms.conf, and use max_matches like this:

[host_enchrichment]
filename = host_enrichment.csv
max_matches = 1

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

You can also clean up your CSV very easily in Splunk by running:

| inputlookup mylookup | dedup host | outputlookup mylookup

which will eliminate all but the first distinct occurence of each host in the file.

chris
Motivator

That works too thanks

0 Karma

bwooden
Splunk Employee
Splunk Employee

By default, Splunk will return up to 100 matches for look-ups not involving a time element. You can update it to only return one.

For an automatic look-up, edit transforms.conf, and use max_matches like this:

[host_enchrichment]
filename = host_enrichment.csv
max_matches = 1

chris
Motivator

Thank you that works

0 Karma
Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...