Commands to link Mysql DB to elasticsearch using logstash.
I am having one configuration file but, it did'nt worked for me!!
input {
jdbc {
jdbc_driver_library => "/root/mysql-connector-java-5.1.30-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://$localhost:3306/jobschema"
jdbc_user => "root"
jdbc_password => "Mysql@123"
tracking_column => "timestamp"
use_column_value => true
statement => "select jobid, jobname, executiontime, jobstatus from logplugin where jobid > :sql_last_value;"
schedule => "*/2 * * * *"
}
}
filter {
date {
match => ["timestamp", "UNIX"]
target => "@timestamp"
}
translate {
field => "agent"
destination => "branch"
dictionary_path => "/opt/agents.yaml"
}
}
output {
elasticsearch {
hosts => ["${ELASTIC_HOSTS}:9200"]
index => "logstashmysql"
}
stdout {
codec => rubydebug
}
}
Pls Solve this problem.