简体   繁体   English

Logstash grok过滤整数

[英]Logstash grok filter integer

I need to index numerical data in my ElasticSearch DB and i'm using grok filter to parse the log line (which is all comma separated integers). 我需要在我的ElasticSearch DB中索引数值数据,并且我使用grok过滤器来解析日志行(这是所有逗号分隔的整数)。

trying to use this format %{NUMBER:userID_2:int} did not work and no data was indexed and no exception appeared. 尝试使用此格式%{NUMBER:userID_2:int}不起作用,没有数据被编入索引,也没有出现异常。

When i changed the type to "float" -ie %{NUMBER:userID_2:float} it worked just fine. 当我将类型更改为“浮动”-ie %{NUMBER:userID_2:float}它工作得很好。

Any idea why i'm not able to index integers? 知道为什么我不能索引整数吗?

(Using elastic 1.4.4 and logstash 1.4.1) (使用弹性1.4.4和logstash 1.4.1)

Thanks! 谢谢!

In "filter" section you set up match expression: 在“过滤器”部分中,您可以设置匹配表达式:

match => "%{NUMBER:user_id}"

and then you convert it: 然后你转换它:

mutate {
  convert => {
    "user_id" => "integer"
    ....
  }
}

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

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