Splunk Search

Using all info from search in subsearch?

stevenahl
New Member
host=*
| map search="| dbquery Database \"SELECT * FROM Table WHERE Column='$host$'\""
| table *

I'm fairly new to Splunk (only been playing with it since last Thursday) and I'm still trying to figure things out. What I'm trying to achieve with script is get all hosts, look them up in the database and then output any data resulting from the match. It seems to work but only for one host where literally hundreds to thousands should be present.

What am I doing wrong?

Tags (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

Try this:

host=* | dedup host | map search="| dbquery Database \"SELECT * FROM Table WHERE Column='$host$'\""

View solution in original post

0 Karma

woodcock
Esteemed Legend

Try this:

host=* | dedup host | map search="| dbquery Database \"SELECT * FROM Table WHERE Column='$host$'\""
0 Karma

stevenahl
New Member

That did it. Why would dedup make that work, though? I don't see the connection...

0 Karma

woodcock
Esteemed Legend

There is probably a limit to the map command and if you do not dedup then you send the same value in over and over and over and over until you hit that limit, before ever getting to any other host values.

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In January, the Splunk Threat Research Team had one release of new security content via the Splunk ES Content ...

Expert Tips from Splunk Professional Services, Ensuring Compliance, and More New ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Observability Release Update: AI Assistant, AppD + Observability Cloud Integrations & ...

This month’s releases across the Splunk Observability portfolio deliver earlier detection and faster ...