Logstash

logstash5.6同步sql server数据

D:\Java\ELK\logstash-5.6.16\bin

.\logstash.bat -f .\mssql\jdbc.conf

 

input {
    stdin {
    }
    jdbc {
        jdbc_driver_library => "D:\Java\ELK\logstash-5.6.16\bin\mssql\sqljdbc42.jar"
        jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
        jdbc_connection_string => "jdbc:sqlserver://127.0.0.1:1433;databaseName=SCST;"
        jdbc_user => "sa"
        jdbc_password => "123456"
        jdbc_default_timezone => "Asia/Shanghai"
        statement => "SELECT * FROM dbo.Student"
    }
}

output {
    elasticsearch {
        # ES的IP地址及端口
        hosts => ["localhost:9200"]
        # 索引名称
        index => "article"
        # 自增ID 需要关联的数据库中有有一个id字段,对应索引的id号
        document_id => "%{S#}"
    }
    stdout {
       # JSON格式输出
        codec => json_lines
    }
}

 

 

 

 

 

资料

https://www.cnblogs.com/a-du/p/7611620.html

https://www.cnblogs.com/tu6ge/p/7815794.html

https://blog.csdn.net/zwq912318834/article/details/78657787

posted @ 2019-03-25 21:29  ~沐风  阅读(116)  评论(0编辑  收藏  举报