Logstash-filter-rest sent field references incorrectly it always reference first field value it had referened

冷暖自知 提交于 2019-12-11 10:35:04

问题


I recently use logstash-filter-rest, and configure it like below:

rest {
    url => "http://example.com/api"
    sprintf => true
    method => "post"
    params => {
      "post_key" => "%{a_field_in_log}"
    }
    response_key => "my_key"
}

after this, logstash make a post request to my api, but something is wrong, the value of a_field_in_log is identical in every request ( I check api access log, all of the value is the first field value sent to api ) it seems like there have caches for referenced field.

Does someone had encountered same problem, would thank you for your help!


回答1:


As it happens, I'm the author of logstash-filter-rest and I'm glad to hear that someone is actually using it.

I was able to reproduce your issue. It was a bug and (good news) I fixed it. Thank you for reporting!

You can update now to the new version 0.1.5.

../logstash/bin/plugin update logstash-filter-rest

Test config:

input { stdin {} }
filter {
        grok { match => [ "message",  "Hello %{WORD:who}" ] }
        rest {
                url => "http://requestb.in/1f7s1sg1?test=%{who}"
                method => "post"
                sprintf => true
                params => {
                        "hello" => "%{who}"
                }
        }
}
output { stdout{ codec => "rubydebug" } }

Test data:

Hello John
Hello Doe
Hello foo
Hello bar

Result:

http://requestb.in/1f7s1sg1?inspect (looks good)

Many thanks for contributing! I hope everything works as expected now.



来源:https://stackoverflow.com/questions/33250615/logstash-filter-rest-sent-field-references-incorrectly-it-always-reference-first

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!