Splunk Search

How to add a new column after lookup match?

cpm003
Path Finder

Hi all,
I'm stuck with this i hope somebody can helps me.

I have a csv lookup with following data for search matches on my previous indexed data

Hostname, Vendor,Product, Version
mke001,apache,http_server,2.4.38
Mke003,apache,http_server,2.3.3

I want to add hostname column to following query:

index=main | table Vendor Product Version | search [ | inputlookup inventory.csv | table Vendor Product Version ]
0 Karma
1 Solution

marycordova
SplunkTrust
SplunkTrust

Try this (I forget if you can use multiple values for the matching part of the lookup the This as That part):

index=main
| table Vendor Product Version
| lookup Vendor as Vendor Product as Product Version as Version OUTPUT Hostname
@marycordova

View solution in original post

0 Karma

DavidHourani
Super Champion

Hi @cpm003,

Check out this answer :
https://answers.splunk.com/answers/135646/lookup-command-multiple-input-fields.html

You can do what you're looking for pretty easily :
Note: The lookup command can accept multiple lookup and local fields and destfields. For example:

lookup <lookup-table-name> <lookup-field1> AS <local-field1>, <lookup-field2> AS <local-field2> OUTPUTNEW <lookup-destfield1> AS <local-destfield1>, <lookup-destfield2> AS <local-destfield2>

So your search should look like this :

index=main | table Vendor Product Version | lookup Vendor,Product,Version  OUTPUT Hostname

Cheers,
David

0 Karma

marycordova
SplunkTrust
SplunkTrust

Try this (I forget if you can use multiple values for the matching part of the lookup the This as That part):

index=main
| table Vendor Product Version
| lookup Vendor as Vendor Product as Product Version as Version OUTPUT Hostname
@marycordova
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 ...