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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...