Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql_last_start isn't persisted when executing logstash as non-sevice #88

Closed
digitalpacman opened this issue Nov 24, 2015 · 7 comments
Closed

Comments

@digitalpacman
Copy link

The only shutdown method implemented is "stop". You also need to implement "close". Sometimes "stop" isn't called and only "close" is. If you run logstash from the command line to do an import of data into elasticsearch, and at a future date want to run it again, but using the sql_last_start (like a monthly/weekly/daily job or something) then it'll never invoke the "stop" method of the plugin.

You should add the YAML.dump() command to the "close" method. I think the "stop" method shouldn't ever be used for this purpose, as it's not reliable.

This is what I did to just get my instance working now.

I added this to inputs/jdbc.rb below the "stop" method.

def close
  puts "closing"
  # update state file for next run
  if @record_last_run
    File.write(@last_run_metadata_path, YAML.dump(@sql_last_start))
  end

  close_jdbc_connection
end
@AvivRatzon
Copy link

This was a huge problem for and digitalpacman's code solved it. thank you :)

@talevy
Copy link
Contributor

talevy commented Jan 5, 2016

Commit bc37474 should fix this

@kaib
Copy link

kaib commented Jan 12, 2016

is this in the new version which i get from plugin install?? For me the state is only persisted when i cancel the execution. When logstasg terminates on his own, then no state is commited

@untergeek
Copy link
Contributor

@kaib If you have plugin version 3.0.0, then sql_last_start has been replaced by sql_last_value. It's a breaking change, as is evidenced by the major version bump.

Please see #57 (comment) for more information.

@kaib
Copy link

kaib commented Jan 12, 2016

@untergeek thanks for the super fast response its working perfekt with 3.0.0, any info about release date of this version?

@untergeek
Copy link
Contributor

@kaib You mean, released in Logstash? Hopefully next week we'll release 2.2, and this version will be included.

@suyograo
Copy link
Contributor

Fixed in v3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants