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!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...