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!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...