Splunk Search

Use field values in a query for loop

nwong1
New Member

Hi, I want to use field values for a search query and then export the results for each field value to a CSV
For example, I have a list of field values

Then for each of these values, I will use them in a search query

list = [1,2,3]

for LIST_VALUE in list:
"index="foo" source="bar"
where name=<LIST_VALUE>

outputcsv <LIST_VALUE>.csv 

Is this possible? Thanks!

Tags (1)
0 Karma

to4kawa
Ultra Champion

use map command

Get Updates on the Splunk Community!

.conf25 Registration is OPEN!

Ready. Set. Splunk! Your favorite Splunk user event is back and better than ever. Get ready for more technical ...

Detecting Cross-Channel Fraud with Splunk

This article is the final installment in our three-part series exploring fraud detection techniques using ...

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...