Splunk Search

DB Connect database input: How to output some text if query gives no results?

tweaktubbie
Communicator

Some important queries that run every 5 or 10 minutes that are configured as DB Connect database inputs, give rarely any results on queries. Only on exceptions. As we have alerts configured that check when the last event was indexed, something like
metadata type=sourcetypes | search sourcetype="something:else" | where lastTime<now()-3600 (think of it as a universal forwarder down check)

But we either have to filter out this specific host or source when no event comes in, or change the SQL query so that IF no results THEN echo something like OK or Nothing found. That way there's also some kind of healthcheck as a new event should be indexed every run.

Of course you can -as we did for now- configure an identical database input with 'select 'OK' from DUAL' (some kind of PING if you like) - but it would be easier to combine those two inputs into one query. Haven't googled any solution, and our DBA isn't aware of any query that meets the requirements.

0 Karma

jcoates_splunk
Splunk Employee
Splunk Employee

Hi, can you file an enhancement request with support?

0 Karma
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 ...