Splunk Search

Is there a way that I can construct a search that will pass a list of values to a field that is expecting just one value?

josefa
Path Finder

Hello,

I have a custom command from an app where I can do a search like sourcetype=mysourcetype | customcommand ioc=1.1.1.1
If I try to do something like sourcetype=mysourcetype | dedup src_ip | customcommand ioc=src_ip I get an error, as the command is expecting a defined format/value for the ioc parameter.

Is there anyway I can achieve sending the src_ip values, one by one, to the customcommand?

Thanks in advance for your help.

PS: is there a better way to get the unique src_ip value, besides dedup ?

0 Karma
1 Solution

dmaislin_splunk
Splunk Employee
Splunk Employee

Try looking at the foreach and the map commands in the search language as I believe this will resolve your search issue.

https://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Foreach

http://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Map

View solution in original post

dmaislin_splunk
Splunk Employee
Splunk Employee

Try looking at the foreach and the map commands in the search language as I believe this will resolve your search issue.

https://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Foreach

http://docs.splunk.com/Documentation/Splunk/6.4.3/SearchReference/Map

josefa
Path Finder

Thanks for your reply!

The map command work sourcetype=mysourcetype src_ip=* | dedup src_ip | map search=" customcommand ioc=$src_ip$" | table indicator owner dest_ip
Although, I'm not getting the information of dest_ip in the table. I'm guessing this is because there's no more information in the Events tab than the one retrieve from the kvstore the customcommand uses (no events from the original search can be seen)

Any idea how can I have the original events, or would the app have to be modified to work in this way?

0 Karma
Get Updates on the Splunk Community!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...