ELK Stack 已成功设置。
使用 grokdebug.herokuapp.com
我的 gork 模式也有效并被转储到 ElasticSearch
filter {
if [type] == "some_log" {
grok {
match => { "message" => '%{WORD:word_1} %{TIME:time_1} %{DATE:date_1} %{NUMBER:number_1}'
}
overwrite => "message"
}
}
}
这种对输入的 grok 解析是完全正确的。
输出是
output {
elasticsearch {
protocol => "http"
}
}
问题是所有转储变量都是字符串类型。
如何让他们在 ElasticSearch 中登录到各自的类型(正确的映射类型)
time_1、date_1 和 number_1 都具有相同的类型
"time_1":{
"type":"string",
"norms":{
"enabled":false
},
"fields":{
"raw":{
"type":"string",
"index":"not_analyzed",
"ignore_above":256
}
}
}
我希望 date_1 被索引为日期类型,number_1 被索引为弹性搜索中的数字类型。
PS:有可能吗??从 Logstash 中确定 Type of Elasticsearch 字段。
或 - 如何将具有正确类型的字段发送到 ElasticSearch。
谢谢