Data type conversion using logstash grok

前端 未结 1 1633
梦如初夏
梦如初夏 2021-01-28 08:49

Basic is a float field. The mentioned index is not present in elasticsearch. When running the config file with logstash -f, I am getting no exception.

相关标签:
1条回答
  • 2021-01-28 09:11

    You have two problems. First, your grok filter is listed prior to the csv filter and because filters are applied in order there won't be a "Basic" field to convert when the grok filter is applied.

    Secondly, unless you explicitly allow it, grok won't overwrite existing fields. In other words,

    grok{
        match => [
            "Basic", " %{NUMBER:Basic:float}"
        ]
    }
    

    will always be a no-op. Either specify overwrite => ["Basic"] or, preferably, use mutate's type conversion feature:

    mutate {
        convert => ["Basic", "float"]
    }
    
    0 讨论(0)
提交回复
热议问题