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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...