2

问题:Logstash JDBC + Sequel 是否会因包含方括号的列名而窒息?

如果是这样,有什么办法可以让他们玩得很好?

我在 JDBC 输入插件中使用 Logstash 7.3.0 及其捆绑的 Sequel 从 Oracle 视图中获取数据,并使用 Oracleojdbc6.jar作为驱动程序。

该视图的列名包含方括号,例如alternative[company_name].

Logstash 在摄取时崩溃,但有以下异常:

[2019-08-07T11:13:37,899][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2019-08-07T11:47:30,325][INFO ][logstash.inputs.jdbc     ] (....) select * from (
    select "_id"
    ,"company_name"
    ,"address"
    ,"city"
    ,"zip"
    ,"state"
    ... and some similar columns ...
    ,"alternative[company_name]"
    ,"alternative[address]"
    ,"alternative[city]"
    ,"alternative[zip]"
    ,"alternative[state]"
    ,"alternative[is_main_sos]"
    ... then some other columns ...
    from <my view>
    order by "_id"
)
where ROWNUM < 100

[2019-08-07T11:47:30,417][WARN ][logstash.inputs.jdbc     ] Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::OrgLogstash::FieldReference::IllegalSyntaxException: Invalid FieldReference: `alternative[company_name]`>}
[2019-08-07T11:47:31,326][INFO ][logstash.runner          ] Logstash shut down.

相同的查询通过 DBeaver 使用 JDBC 可以正常工作,所以我想知道 Logstash 和/或 Sequel 是否有任何特殊之处。

感激地收到帮助。

4

0 回答 0