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!

Learn Splunk Insider Insights, Do More With Gen AI, & Find 20+ New Use Cases You Can ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Buttercup Games: Further Dashboarding Techniques (Part 7)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Stay Connected: Your Guide to April Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...