I am using Logstash to output logs from a Tomcat access log into elasticsearch. The pattern I am using is as follows:
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}"
}
As you seen above the field duration us formatted as NUMBER.
When logging the information in elasticsearch and doing a REST query through Chrome sense plugin as follows:
GET /_all/_mapping?pretty=1
It identifies the field but with type String as follows:
"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
}
}
}
I would expect it to understand it as a number. Is this expected?
For example other fields like geoip are understood as a different type than string.
"geoip": {
"dynamic": "true",
"properties": {
"location": {
"type": "geo_point"
}
}
},
Thx in advance