[英]Logstash duplicates template properties
I'm trying to set a custom template for a specific index. 我正在尝试为特定索引设置自定义模板。 The issue is when I create it in Kibana, I see some duplicated properties such as
type
and _type
(with the "_"). 问题是当我在Kibana中创建它时,我看到了一些重复的属性,例如
type
和_type
(带有“ _”)。 I've been trying different template "approaches" but without success... Also, I guess the default template keeps overriding the custom one. 我一直在尝试使用不同的模板“方法”,但没有成功...另外,我猜默认模板始终覆盖自定义模板。
This is my output configuration: 这是我的输出配置:
output {
if [type] == "something" {
elasticsearch {
(... omitted ...)
manage_template => true
index => "log-%{+YYYY.MM.dd}"
template_name => "log-template"
template => "/etc/logstash/templates.d/log.json"
template_overwrite => true
}
}
The following is my template file: 以下是我的模板文件:
{
"template": "log-*",
"order": 1,
"settings": { "index.refresh_interval": "5s" },
"mappings":
{
"_default_":
{
"dynamic": "strict",
"_all": { "enabled": false },
"properties":
{
"@timestamp": { "type": "date", "format": "dateOptionalTime" },
"file": { "type": "string" },
"host": { "type": "string" },
"host": { "type": "string" }
}
}
}
}
Before I try each new template config I stop logstash, remove all the indexes and templates - just like the official documentation suggests. 在尝试每个新的模板配置之前,请先停止logstash,然后删除所有索引和模板-就像官方文档所建议的那样。 Only after, I run run logstash and create the index at Kibana.
之后,我运行run logstash并在Kibana创建索引。
If you go to Settings > Advanced, you can edit the metaFields
setting and only write _source
in there, so that _type
, _id
and _index
don't show up anymore: 如果转到“设置”>“高级”,则可以编辑
metaFields
设置,仅在其中写入_source
,这样_type
, _id
和_index
不再显示:
Then reload your Kibana page and in the Discover tab you'll only see the _source
field. 然后重新加载您的Kibana页面,在“发现”选项卡中,您只会看到
_source
字段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.