logstash 数据库配置文件

验证通过

文件名:sqlserver.conf

input {
stdin {
}
jdbc {
jdbc_connection_string => "jdbc:sqlserver://localhost:1433;databaseName=Test"
# the user we wish to excute our statement as
jdbc_user => "sa"
jdbc_password => "123456"
# the path to our downloaded jdbc driver
jdbc_driver_library => "D:/elasticsearch/logstash-6.2.1/sqlserver/sqljdbc42.jar"
# the name of the driver class for mysql
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
#要执行的sql文件
#statement_filepath => "/conf/course.sql"
statement => "select name,description,studymodel from dbo.xc_course"
#定时配置
schedule => "* * * * *"
record_last_run => true
last_run_metadata_path => "D:/elasticsearch/logstash-6.2.1/config/logstash_metadata"
}
}


output {
elasticsearch {
#ESIP地址与端口
#hosts => "localhost:9200"
hosts => ["localhost:9200"]
#ES索引名称(自己定义的)
index => "xc_course"
#自增ID编号
document_type => "doc"
template =>"D:/elasticsearch/logstash-6.2.1/config/xc_course_template.json"
template_name =>"xc_course"
template_overwrite =>"true"
}
}

 

----------------------------------------------------------------------------------------------------

{
"mappings" : {
"xc_course" : {
"_source" : {

},
"properties" : {

"description" : {
"type" : "text"
},
"name" : {
"type" : "text"
},
"studymodel" : {
"type" : "keyword"
}
}
}
},
"order" : 0,
"template" : "xc_course"
}

posted on 2020-03-25 21:27  四海骄阳  阅读(1035)  评论(0编辑  收藏  举报

导航