Insert Elastic Data to Mysql

50 Views Asked by At

I have trouble in transferring data from elastic to mysql using logstash. I get error "Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError",". The error generated is :

[ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [^\\r\\n], \"\\r\", \"\\n\" at line 21, column 4 (byte 732) after # }", :backtrace=>["C:/Users/rakesh.s/Documents/ELK/logstash-7.15.0/logstash-core/lib/logstash/compiler.rb:32:in `compile_imperative'", "org/logstash/execution/AbstractPipelineExt.java:187:in `initialize'", "org/logstash/execution/JavaBasePipelineExt.java:72:in `initialize'",

here is my logstash config

input {
  elasticsearch {
    hosts => "localhost:9200"
    index => "testrak"
    query => '{"query": { "match_all": {} }}'
    scroll => "5m"
  }
}


output {
  jdbc {
    jdbc_driver_library => "C:/Program Files (x86)/MySQL/Connector J 8.0/mysql-connector-java-8.0.29.jar"
    jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://localhost:3306/elasticdata"
    jdbc_user => "root"
    jdbc_password => ""
    statement => "INSERT INTO elastic_table (id, incident_number, created_on, service_name, ed) VALUES (?, ?, ?, ?, ?)"
    parameters => ["id", "incident_number", "created_on", "service_name", "ed"]
    schedule => "* * * * *"
  }
}

i have no idea, whats wrong here. please suggest.

0

There are 0 best solutions below