Splunk Cloud Platform

Use of IN Clause to find out available host in splunk

mchoudhary
Explorer

Hi Team,

I am a newbie in Splunk. I am using a basic IN clause in a search command to pull out the 36 windows server integration available or not in splunk.

index=* NOT index=_* host IN ("host1", "host2", "host3", ...., "host36")
| stats count by host

It gives me the servers which are available in splunk. I want to find out the missing ones and the available ones in this format-

hoststatus
host1Available
host2Available
host3Missing

I am using the below query but it only gives 6 statistics.

| makeresults count=1
| eval all_hosts="host1,host2,host3....host36"
| makemv delim="," all_hosts
| mvexpand all_hosts
| rename all_hosts AS host
| append [ search index=* NOT index=_* host=*
    | stats count by host ]
| stats values(count) AS event_count by host
| where host IN ("host1", "host2",....,"host36")
| eval status=if(isnull(event_count), "Missing", "Available")
| table host status
| sort status, host

 Can anyone please help me out what I am doing wrong.

Thanks in Advance!!

Labels (1)
Tags (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

index=* NOT index=_* host=*
| stats count by host
| append
  [| makeresults
  | eval host=split("host1,host2,host3....host36",",")
  | mvexpand host
  | eval count=1]
| stats sum(count) AS event_count by host
| eval status=if(event_count = 1, "Missing", "Available")
| table host status
| sort status, host
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...