【问题标题】:logstash input jdbc take mysql tinyint 0/1 as boolean true/falselogstash 输入 jdbc 将 mysql tinyint 0/1 作为布尔值 true/false
【发布时间】:2021-12-29 02:12:02
【问题描述】:

在 mysql 表中,有一个类似这样的 tinyint 类型,它只存储 0 或 1 个值,如 is_mel:1

is_mel | tinyint(1)

在 Elasticsearch 索引映射配置中 is_mel 为整数。

但从 logstash 日志中,它显示它将 is_mel 解析为布尔值 true 或 false,如 "is_mel":true,这将导致以下错误,

"type"=>"mapper_parsing_exception",
"reason"=>"failed to parse field [is_mel] of type [integer] in document with id '392289'. Preview of field's value: 'true'"

【问题讨论】:

    标签: mysql elasticsearch input jdbc logstash


    【解决方案1】:

    实际上是a feature, not a bug :-)

    您可以将tinyInt1isBit=false 附加到您的 JDBC URL 以禁用该行为

    jdbc.url=jdbc:mysql://127.0.0.1:3306/testdb?tinyInt1isBit=false
                                                        ^
                                                        |
                                                     add this
    

    Link to the related MySQL doc

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-12
      • 2015-10-15
      • 1970-01-01
      • 2011-11-25
      • 1970-01-01
      • 1970-01-01
      • 2016-02-01
      相关资源
      最近更新 更多