Splunk Search

metadata search for tagged and untagged servers

pil321
Communicator

I'm trying to do a search for servers that have reported to verify their status (server up or server down). I have something like this:

|metadata type=hosts | eval status=if((now()-lastTime < 60, "server up", "server down") | fields host,status | sort host

I also have servers that have been decommissioned and are tagged as such (tag::decommissioned).

How do I exclude the tagged servers from my search? Or, is there a better way to do this?

Tags (1)
0 Karma
1 Solution

jtrucks
Splunk Employee
Splunk Employee

You have to insert the tags into the results and then filter it out like:

|metadata type=hosts |tags | search NOT tag::decommissioned=* |  eval status=if(now()-lastTime < 60, "server up", "server down") | fields host,status | sort host

🙂

--
Jesse Trucks
Minister of Magic

View solution in original post

jtrucks
Splunk Employee
Splunk Employee

You have to insert the tags into the results and then filter it out like:

|metadata type=hosts |tags | search NOT tag::decommissioned=* |  eval status=if(now()-lastTime < 60, "server up", "server down") | fields host,status | sort host

🙂

--
Jesse Trucks
Minister of Magic

pil321
Communicator

Thanks jtrucks!

I had to modify it slightly, but it worked:
...| tags | search NOT tag::host="decommissioned" | ...

Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...