gpt4 book ai didi

elasticsearch - ELK Stack-自定义自动生成的字段映射

转载 作者:行者123 更新时间:2023-12-03 00:42:05 29 4
gpt4 key购买 nike

我有一个非常基本的ELK堆栈设置,并通过syslog将日志传递给它。我使用内置的grok模式将日志拆分为多个字段。但是字段映射是由logstash elasticsearch插件自动生成的,我无法对其进行自定义。

例如,我使用logstash配置文件通过名称“dst-geoip”创建了一个新字段:

geoip {
database => "/usr/local/share/GeoIP/GeoLiteCity.dat" ### Change me to location of GeoLiteCity.dat file
source => "dst_ip"
target => "dst_geoip"
fields => [ "ip", "country_code2", "country_name", "latitude", "longitude","location" ]
add_field => [ "coordinates", "%{[dst_geoip][latitude]},%{[geoip][longitude]}" ]
add_field => [ "dst_country", "%{[dst_geoip][country_code2]}"]
add_field => [ "flow_dir", "outbound" ]
}

我想为其分配类型“geo_point”,我无法从Kibana进行编辑。在线文档提到使用ElasticSearch API手动更新各个索引上的映射。但是Logstash会生成许多索引(每天一个)。如果我更新一个索引,映射在将来的索引中会保持不变吗?

最佳答案

您正在寻找的是一个“template”。

关于elasticsearch - ELK Stack-自定义自动生成的字段映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35076573/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com