How to copy SQL Server data to Elasticsearch using LogStash

As a developer working with SQL Server there is a need to import data from the database to Elasticsearch and analyze data in Kibana

Hello,

The JDBC input plugin is your best bet, to do this with Logstash. This input plugin even has built-in support to set the import schedule.

https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html

If this isn't flexible enough, another option is to build a small script using one of the Elasticsearch client libraries.

https://www.elastic.co/guide/en/elasticsearch/client/index.html

here is example

input {
    jdbc {
        jdbc_validate_connection => false
        jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
        jdbc_connection_string => "jdbc:sqlserver://server_name;databaseName=db_name;user=username;password=password;"
        jdbc_user => "username"
        jdbc_password => "password"
        statement => "select * from db_name.table_view_name"
        schedule => "00 06 * * *"
        clean_run=>true
       }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.