How can i schedule logstash every second for jdbc input plugin?

Hi All

I am using this configuration for jdbc input plugin

schedule => "* * * * *"

How I can schedule logstash for every 1 second or 2 second?

Regards
Ritesh

1 Like

Has no one used jdbc logstash plugin?

Ritesh,

The current schedule config that you have is for every second. For every 2 seconds I believe you just use '2 * * * * '

rufus-scheduler is a good guide to get the correct time take a look on git

1 Like

The Cron format has been extended to support seconds :
"* * * * " means every minute
"
* * * * " means every second
"
/2 * * * * *" means every 2 seconds
Hope this helps...

3 Likes

Hi Guys,

How do I get it for every 24 hours?

I tried both lines below:

      • */24
        */24 * * *

But none worked, it said it was a bad cronline in the output.

Thanks,

"30 4 * * *"
Run every day at 4:30AM

"0 0 * * *"
Run every day at 12:00AM

"59 23 * * *"
Run every day at 11:59PM

"0 12 * * *"
Run every day at 12:00PM

1 Like

Hi, rkhapre:
Did you solve this problem? How?
I have the same issue now. I have to narrow down the period to every 5 seconds.

Hope to hear from you, thanks.

Hi

5 star means every 1 second

schedule => "* * * * *"

for every 5 second use this

schedule => "5 * * * *"

Thanks. I found out in the code, */5 * * * * * means every 5 seconds.
And what version of Logstash are you using?

PS: it 'handles crontab steps syntax in six-field forms' do
expect(Rufus::Scheduler::CronLine.new(
'*/10 * * * * ').frequency).to eq(10)
expect(Rufus::Scheduler::CronLine.new(
'
*/10 * * * ').frequency).to eq(1) # "" all seconds [0..59]
expect(Rufus::Scheduler::CronLine.new(
'0 */10 * * * *').frequency).to eq(10 * 60)
end

      end

schedule => "*/5 * * * * * " for every 5 seconds

schedule => "* * * * * * " Loads every second

hope you got the difference..

You can't just add another star and take minute resolution down to seconds. Not with cron syntax.

This plugin uses the rufus-scheduler module in cron mode. You can schedule down to the minute (5 fields) just like cron, but not seconds.

Want a query to run every second? Currently this plugin does not allow for that.

1 Like