Logstash无法识别JDBC输入中的环境变量

时间:2016-12-02 14:57:27

标签: jdbc logstash

根据logstash documentation,我可以这样做:

$ export VAR=some_value

input {
    jdbc {
        jdbc_connection_string => ...
        jdbc_user => ...
        jdbc_validate_connection => ..
        jdbc_password => ...
        jdbc_driver_library => ..
        jdbc_driver_class => ...
        jdbc_paging_enabled => ...
        jdbc_page_size => ..
        statement => "SELECT * FROM table where column='{$VAR}'"
}
...

嗯,这没用。所以我试过了:

input {
        jdbc {
            jdbc_connection_string => ...
            jdbc_user => ...
            jdbc_validate_connection => ..
            jdbc_password => ...
            jdbc_driver_library => ..
            jdbc_driver_class => ...
            jdbc_paging_enabled => ...
            jdbc_page_size => ..
            parameters => {"var" => "${VAR}" }               
            statement => "SELECT * FROM table where column= :var"
    }

但是,什么也没发生。要清楚,当我使用

statement => "SELECT * FROM table where column= 'some_value' "

一切正常。那么,我如何让logstash识别环境变量呢?

0 个答案:

没有答案