Logstash kv filter issue with blank values

柔情痞子 提交于 2019-12-24 08:23:58

问题


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

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


回答1:


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

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

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"


来源:https://stackoverflow.com/questions/39389577/logstash-kv-filter-issue-with-blank-values

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