Logstash ingresso jdbc prendere mysql di tipo tinyint 0/1 as boolean true/false

0

Domanda

Nella tabella di mysql, è un tinyint tipo come questo, che è solo memorizzare valore 0 o 1 come is_mel:1.

is_mel | tinyint(1)

In Elasticsearch indice di mappatura config is_mel come integer.

Ma dal logstash log, si mostra analizzare il is_mel come valore booleano true o false come "is_mel":trueche porterà a seguito di errore,

"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'"
elasticsearch input jdbc logstash
2021-11-18 06:50:46
1

Migliore risposta

1

In realtà è una feature, non un bug :-)

È possibile aggiungere tinyInt1isBit=false per il vostro URL JDBC per disabilitare questo comportamento

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

Link al relativo MySQL doc

2021-11-18 08:24:32

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................