Search code examples
mysqlelasticsearchamazon-elastic-beanstalklogstashlogstash-configuration

Error while connecting MYSQL with logstash


I am facing this error while starting logstash. I have configured MYSQL db as input in logstash.

 Pipeline_id:main
  Plugin: <LogStash::Inputs::Jdbc jdbc_user=>"admin", jdbc_password=><password>, statement=>"SELECT * from table", jdbc_driver_library=>"/usr/s$
  Error: Permission denied - /.logstash_jdbc_last_run
  Exception: Errno::EACCES
  Stack: org/jruby/RubyIO.java:1237:in `sysopen'
org/jruby/RubyIO.java:3800:in `write'

Solution

  • The last_run_metadata_path option defaults to "#{ENV['HOME']}/.logstash_jdbc_last_run", and it looks like that evaluates to /.logstash_jdbc_last_run. You are getting EACCES because you do not have write access to the root directory.

    To fix it, set the last_run_metadata_path option to a file in a directory that you have write access to. If you have an input configuration that starts with

    input {
      jdbc {
        jdbc_driver_library => "mysql-connector-java-5.1.36-bin.jar"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
    

    you can just add an additional line there

        last_run_metadata_path => "/tmp/.logstash_jdbc_last_run"
    

    using some path that you know you can write to and that nobody else will be using.