本文介绍了Logstash KV筛选器问题具有空白值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我在logstash配置中使用了kv过滤器,并且我有一个看起来像这样的字符串:

I am using the kv filter in my logstash configuration and I have a string that looks something like this:

key1="value1" key2="" key3= key4=1

请注意,key3没有值;导致将key3分配为"key4=1"的值我该如何解决?

Notice that key3 has no value; that causes key3 to be assigned a value of "key4=1"how do I fix this?

推荐答案

这可能不是最好的解决方案,因为我们盲目地进行了替换:

It might not be the best solution, since we're blindly replacing:

  mutate {
    gsub => [
       "message", "= ", '="" '
    ]
  }

在kv过滤器之前使用此过滤器,将等号后的任何空白都替换为两个引号,得到以下结果:

With this filter before the kv filter, any empty space after an equal sign are replaced with two quotes, giving this result:

"key1": "value1",
"key2": "\"\"",
"key3": "\"\"",
"key4": "1\r"

这篇关于Logstash KV筛选器问题具有空白值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 11:59