Logstash-filter-rest发送的字段引用不正确,它始终引用已引用的第一个字段值 [英] Logstash-filter-rest sent field references incorrectly it always reference first field value it had referened

查看:174
本文介绍了Logstash-filter-rest发送的字段引用不正确,它始终引用已引用的第一个字段值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近使用 logstash-filter-rest ,并按如下所示进行配置:

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"
}

在此之后,logstash向我的api发出发布请求,但是出了点问题,a_field_in_log的值 在每个请求中都是相同的(我检查了api访问日志,所有值都是发送到api的第一个字段值),似乎有被引用字段的缓存.

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!

推荐答案

碰巧,我是 logstash-filter-rest ,我很高兴听到有人实际上正在使用它.

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!

您现在可以更新到新版本0.1.5 .

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

测试配置:

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" } }

测试数据:

Hello John
Hello Doe
Hello foo
Hello bar

结果:

http://requestb.in/1f7s1sg1?inspect (看起来不错)

非常感谢您的贡献!我希望一切都按预期进行.

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

这篇关于Logstash-filter-rest发送的字段引用不正确,它始终引用已引用的第一个字段值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆