Splunk Search

How to create a search where if results under "query" field matches anything under hostname, then alert or show results?

YangThomas
New Member

Currently using splunkes' managed lookup table called hosts. There's a field too called hostname within the file.

I'm trying to create a search where if results under "query" field matches anything under hostname, then alert or show results.

here's what I have so far..

index=opendns
[ | inputlookup hosts
| search hostname
| table hostname query]

Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @YangThomas,

in a subsearch you have to use the exact fieldnames of the main search, in other words i you want to match the hostname field (in the lookup) with the host field in the search, you have to rename it.

I don't understand what you want to match with the "query" field, also because query is a special name in SPL, anyway if query is a field both in the lookup and the main search, you could try something like this:

index=opendns
[ | inputlookup hosts
| rename hostname AS host
| table host query]

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...

[Puzzles] Solve, Learn, Repeat: Dereferencing XML to Fixed-length events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...