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!

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

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...