TransWikia.com

Use data from Mysql to ElasticSearch with Logstash

Database Administrators Asked by BlueSeph on November 21, 2021

I’m using logstash for use my mysql database in ElasticSearch

My conf is the next.

input {
    jdbc {
        jdbc_connection_string => "jdbc:mysql://[ip]:3306/nextline_dev"
        jdbc_user => "[user]"
        jdbc_password => "[pass]"
        #schedule => "* * * * *"
        #jdbc_validate_connection => true
        jdbc_driver_library => "/path/mysql-connector-java-6.0.5.jar"
        jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
        statement => "SELECT * FROM Account"
    }
}
output {
    elasticsearch {
        index => "account"
        document_id => "%{id}"
        hosts => ["127.0.0.1:9200"]
    }
}

But I have some questions, I want to schedule more than one query, but the index will be always account.

Can I make a dynamic index for the output to elasticsearch? And how can I use more than one statement? (Export more than one table)

One Answer

I found that ELK LogStash 6.X have document_id deprecated, so if I use my configuration without document_id it works.

Answered by BlueSeph on November 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP