Logstash Configuration for Multi-Database Input Monitoring and Notification

In Logstash, I have multiple inputs, such as Oracle and MySQL databases. Each input contains a query to retrieve data. I need to check if the process reaches each database input and executes the query, If the result of the query is empty (no data), or if the query specifies a condition like "where id > 5" and there are no records with an ID greater than 5, I need to detect this and send a notification to indicate that the synchronization is working but there are no records.