简体   繁体   English

Logstash字段名称以

[英]Logstash field name start with

For example i have the following JSON: 例如,我有以下JSON:

{
  params{
    firstname : value1,
    .lastname : value2
  }
}

How can i check if the name of a field (not the value) start with "." 如何检查字段名称(而不是值)是否以"."开头"." and delete it? 并删除它?

BR BR

If your are using the json filter to parse the json you can use the mutate filter with gsub to remove all the "." 如果您使用的是json过滤器来解析json,则可以将mutate过滤器与gsub一起使用,以删除所有"." before using the json filter. 在使用json过滤器之前。 But only if you are sure the dots are only in the beginning of the field names. 但是只有当您确定点仅在字段名称的开头时,才可以。

It would look like this : 它看起来像这样:

# Removing all the dots from the field message
mutate {
    gsub => ["message", "\.", ""]
}

json {
    source => "message"
}    

There is an alternative, which is the de_dot filter. 还有一个替代方法是de_dot过滤器。 You'll have to install it and it is apparently expensive ressource-wise. 您必须安装它,这显然在资源上很昂贵。

de_dot filter documentation de_dot过滤器文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM