Logstash JDBC, checking for 0 records

How do I check for JDBC if it returns 0 records?

When I run JDBC, and it returns 0 records or has nothing to output. How do I say if the records retrieved are 0?

To expand on this. If a JDBC runs and it returns 0 records. Does it still execute an event? If so, how do I detect it? If not, how do I get it to show 0 records retrieved?

Does it still execute an event?

No.

If not, how do I get it to show 0 records retrieved?

I don't believe that's possible. Why is this important to you, i.e. what's the underlying problem you want to solve?

1 Like

Hello Magnus,

When I run the JDBC, it runs every hour. I want to be able to find out if the query extracted records or not.
When I run the JDBC and it returns resutls, I output a file which contents of the JDBC query. If not, I still output a file but with a content of "No records retrieved".

I tried using the generator plugin, to mock up an event when JDBC does not run. Although I was unable to place a scheduler for it.

Can you suggest a better way for tackling the problem when JDBC returns no records? And Recording the event.

Thanks,