我正在使用Logstash将来自Tomcat访问日志的日志输出到elasticsearch。 我使用的模式如下:Elasticsearch不理解Logstash类型
grok {
type => "access_log"
pattern => "\[%{DATA:my_timestamp}\] %{IP:client} %{WORD:method} %{URIPATHPARAM:request} \[%{DATA:auth_data}\] \[%{DATA:another_timstamp}\] %{NUMBER:result_code} %{NUMBER:duration} %{NUMBER:bytes}"
}
当你场期间我们格式化为NUMBER上面看到的。
登录时elasticsearch的信息,并通过镀铬感插件做一个REST查询,如下所示:
GET /_all/_mapping?pretty=1
它识别领域,但与String类型如下:
"duration": {
"type": "multi_field",
"fields": {
"duration": {
"type": "***string***",
"omit_norms": true
},
"raw": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs",
"include_in_all": false,
"ignore_above": 256
}
}
}
我期望它把它理解为一个数字。这是预期的吗?
例如geoip等其他字段被理解为与字符串不同的类型。
"geoip": {
"dynamic": "true",
"properties": {
"location": {
"type": "geo_point"
}
}
},
THX提前
Thx。您提供的方向非常有帮助,并将我带入解决方案。 –
@ isaac.hazan所以我有同样的问题,你的评论导致我认为这不是直接的答案? – stedotmartin
是的,为了使这项工作,我必须在elasticsearch中定义索引的类型如下:“evtTime”:{“type”:“date”,“format”:“dd/MMM/yyyy:HH:mm:ss” }, –