Splunk Search

eval'd value: Why is the 'search' command not able to get the value?

mfrost8
Builder

I'm trying to use a search that looks like

index=<index> sourcetype=<sourcetype>
| eval site=<site>
| lookup host_and_site_coords site OUTPUT host AS siteHost 
| search host=siteHost

That first 'eval' for 'site' is there because it's passed in as a token, but in the normal search it's not necessary. Just needed for troubleshooting this.

My problem is that everything works as expected up to the final 'search' command. That is, the lookup works and creates siteHost as I'd expect. The search command doesn't seem to get the value, however, result in what seems like ' search host="" '.

I know that with subsearches you can't pass in an eval'd value, but I didn't think that applied here.

Or maybe I'm missing something really obvious...

Thanks

0 Karma
1 Solution

somesoni2
Revered Legend

If all you're doing is filter result based on hosts for a site, try this subsearch filter.

index=<index> sourcetype=<sourcetype> [ | inputlookup host_and_site_coords | table site host | where site="<site value from token>" | table host ]

View solution in original post

0 Karma

somesoni2
Revered Legend

If all you're doing is filter result based on hosts for a site, try this subsearch filter.

index=<index> sourcetype=<sourcetype> [ | inputlookup host_and_site_coords | table site host | where site="<site value from token>" | table host ]
0 Karma

mfrost8
Builder

That did it. Thanks very much, somesoni2.

This one falls into another "why didn't I think of that?" category for me. 🙂

0 Karma
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...