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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...