身安不如心安,屋宽不如心宽 。

logstash的input和output的statement => 有个需求怎么设置

Logstash | 作者 ljx95315 | 发布于2018年08月03日 | 阅读数:5760

我的input获取数据库数据是这么写的statement => "SELECT * FROM A"
我的output保存数据的的statement字段应该怎么写呢?因为A表有100个字段,一个一个写很费劲
已邀请:

luohuanfeng

赞同来自:

你output到哪里啊?

ljx95315

赞同来自:

我的output通过jdbc-output到另一个数据库并不是到elasticsearch

laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net

赞同来自:

实现参考:
output {
jdbc {
driver_class => 'org.postgresql.Driver'
connection_string => 'jdbc:postgresql://hostname:5432/database?user=username&password=password'
statement => [ "INSERT INTO log (host, timestamp, message) VALUES(?, CAST (? AS timestamp), ?)", "host", "@timestamp", "message" ]
}
}
你使用的插件是:logstash_output_jdbc ,建议多参考下github logstash_outpu_jdbc的相关应用。

heyddo

赞同来自:

给你个方法,参考一下
不一定是最优的办法,可以一起讨论讨论

微信截图_20180808141021.png


 

要回复问题请先登录注册