好的想法是十分钱一打,真正无价的是能够实现这些想法的人。

logstash的数组怎么在写在output?求大佬告知

Logstash | 作者 SilenceRain | 发布于2019年11月25日 | 阅读数:1989

本人使用logstash output jdbc插件,因想使用动态的sql,但是到了output里面 给jdbc 参数赋值的时候,总是会被转为字符串,导致jdbc插件,解析不了。数据如下:
{
"area" => 35,
"level" => 85,
"openId" => "469358",
"@metadata" => {
"ip_address" => "192.168.2.2",
"beat" => "filebeat",
"version" => "7.4.2",
"type" => "_doc"
},
"statementArray" => [
[0] "insert into test(uuid,token)values(?,?)",
[1] "3500057,1"
],
"channel" => "1",
"count" => 4,
"mid" => 205001,
"type" => 1,
"uuid" => "3500057",
"sendTime" => 1574073183032,
"sql" => "insert into test(uuid,token)values(?,?)",
"token" => 1,
"addType" => 127,
"@timestamp" => 2019-11-25T04:58:36.700Z,
"data_value" => [
[0] "3500057",
[1] 1
],
"roleName" => "泣花之无极",
"key" => "test",
"mRank" => 12
}

配置文件jdbc输出:
jdbc{
driver_jar_path => "D:\elk\logstash-7.4.2\bin\mysql-connector-java-8.0.18.jar"
driver_class => "com.mysql.cj.jdbc.Driver"
connection_string => "jdbc:mysql://127.0.0.1:3306/ddt2?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true"
username => "root"
password => "123456"
unsafe_statement => true
statement => "%{[jdbc_statement]}"
}
已邀请:

SilenceRain - 22

赞同来自:

已解决

zhahuan

赞同来自:

可以解决我一千张表数据导到es里面么

要回复问题请先登录注册