问题
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