elasticsearch - Logstash 时间戳在 Elasticsearch 中显示为文本
问题描述
我正在使用 Elasticsearch 7.3.1 和 Logstash 7.3.1。我正在尝试使用日期过滤器将我的一个字段作为 Elasticsearch 时间戳。数据正在正确插入,但类型@timestamp
即将到来text
。我该如何解决?
我的输入时间戳就像1567408605794750813
. 我的代码是:
input {
elasticsearch {
hosts => "x.x.x.x"
index => "raw"
docinfo => true
}
}
filter {
mutate {
convert => {
"timestamp" => "integer"
}
}
date {
match => ["timestamp", "UNIX_MS", "ISO8601"]
target => "@timestamp"
}
}
output {
elasticsearch {
index => "logs-%{app_name}"
document_id => "%{[@metadata][_id]}"
}
}
运行映射 API 后,我得到
"@timestamp" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
解决方案
试试下面的代码,
date {
match => [ "[timestamp]", "UNIX" ]
target => "[@timestamp]"
}
推荐阅读
- angular - 其他模块中的图表
- javascript - 如何在Javascript中实现刷新状态?
- node.js - 子目录中的 Nuxtjs 和 Nginx 反向代理
- javascript - 尝试在 edureka 上复制 API 教程
- javascript - Google Analytics(分析)客户端 ID 不会进入我表单的隐藏字段
- java - 从前台服务更新 Singleton 成员属性
- python - Python Azure 函数 - 使用 Key Vault 进行 MSI 身份验证
- swift - SwiftUI 绑定对象数组并显示更改
- bazel - 让所有 Bazel 包公开它们的文档文件(或任何具有给定扩展名的文件)
- python - 如何在我的代码中出现这个溢出?