Splunk Search

Inputlookup subsearch

msachdeva3
Explorer

I have a csv file with some stats code, i have added as a lookup .

I want to use two fields in stats code with say field1=yes and field2=
field2 i there in index but with a different name. I want to restrict search using limited values of field2 in inputlookup in main splunk index sourcetype

I'm not sure if i have write syntax or I'm unable to use inputlookup

index = f sourcetype = bar dedup [|inputlookup statscode.csv | serch field1="Yes" AND fields2 =]
???

I'm not really sure how to for formulate subsearch??
when do I close brackets []

trying to read arcticles but not close to complete a task...

any good respurce to learn inputlookups

0 Karma

niketn
Legend

Lookup files serve as a table with foreign key which can be joined via Splunk search over a particular index. Like any relational DB joins you will have to ensure that the field name from SPL Search matches that present in the lookup table (you can easily perform this by eval or rename).

For example if you have lookup file added statscode.csv and you created a lookup field statscode, you can try the following:

1) Run following to see content of lookup file(also ensure that it is correct and accessible)

|inputlookup statscode

2) Run the Splunk search on index (assuming field1 and field3 are the fields from index being searched). Rename field3 as field2 (assuming field2 is present in lookup table) and join to lookup table statscode field2 through lookup command.

index="foo" sourcetype="bar" field1="Yes"| eval field2=field3 | lookup statscode field2 | table field1, field2, field3 ....

Splunk Search reference will be a good place to read and try out some examples:
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup

Geostats table example in Splunk 6.x Dashboard Examples app also uses a lookup table to map States to their geocoodinates (present in the lookup table).

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

hunters_splunk
Splunk Employee
Splunk Employee

Thanks for your question, masachdeva3,

I'm not sure the exact query you want to run in your .csv file, but this is the correct syntax of inputlookup:

| inputlookup [append=] [start=] [max=] [ | ] [WHERE ]

Please refer to the detailed usage instructions here:
http://docs.splunk.com/Documentation/Splunk/6.5.0/SearchReference/Inputlookup

Hope it helps. Thanks!
Hunter

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!

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...