gpt4 book ai didi

elasticsearch - ELK Logstash无法在ES中创建索引

转载 作者:行者123 更新时间:2023-12-02 22:54:38 26 4
gpt4 key购买 nike

在遵循此tuto(https://www.bmc.com/blogs/elasticsearch-logs-beats-logstash/)以使用logstash分析某些日志文件之后,我的索引在第一次创建时就很好,然后我想用新的过滤器和新的存储库重新索引新文件,因此我通过“curl XDELETE”删除了”索引,现在当我重新启动logstash和filebeat时,不再创建索引。。启动组件时,我看不到任何错误。
是否需要删除其他内容才能重新创建索引?

最佳答案

好的,因为我的猜测(请参阅评论)是正确的,所以这里的解释是:

为避免filebeat反复读取和发布文件行,它使用注册表来存储收割机的当前状态:

The registry file stores the state and location information that Filebeat uses to track where it was last reading.



如您所述,filebeat成功收获了文件,将行发送到logstash,logstash将事件发布到了elasticsearch,后者创建了所需的索引。由于filebeat更新了其注册表,因此无需删除更多行,因此即使删除索引,也不会将事件再次发布到logstash。当您插入一些新行时,filebeat重新打开了收割机,并仅将新行(在“注册表检查点”之后)发布到logstash。

注册表文件的默认位置是 ${path.data}/registry(请参阅 Filebeat's Directory Layout Overview)。

... maybe the curl api call is not the best solution to restart the index



这与删除索引无关。删除索引发生在elasticsearch内部。 Filebeat不了解您在Elasticsearch中的操作。

Q: Is there a way to re-create an index based on old logs?



是的,您应该考虑以下几种方法:
  • 您可以使用reindex API将文档从一个索引复制到另一个索引。您可以在将文档重新索引到新索引的同时更新文档。
  • 与重新索引相反,您可以使用update by query API更新将保留在原始索引中的文档。
  • 最后,您当然可以删除注册表文件。但是,这可能会导致数据丢失。但是出于开发目的,我想那很好。

  • 希望我能为您服务。

    关于elasticsearch - ELK Logstash无法在ES中创建索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59561751/

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