Filebeat :数据路径已被另一个节拍锁定。请确保多个节拍不共享相同的数据路径

Filebeat : data path already locked by another beat. Please make sure that multiple beats are not sharing the same data path

查看其中一个 filebeat 中的日志 pods 我可以看到:

2021-01-04T10:10:52.754Z        DEBUG   [add_cloud_metadata]    add_cloud_metadata/providers.go:129     add_cloud_metadata: fetchMetadata ran for 2.351101ms
2021-01-04T10:10:52.754Z        INFO    [add_cloud_metadata]    add_cloud_metadata/add_cloud_metadata.go:93     add_cloud_metadata: hosting provider type detected as openstack, metadata={"ava
ilability_zone":"us-east-1c","instance":{"id":"i-08f536567bd9945df","name":"ip-10-101-2-178.ec2.internal"},"machine":{"type":"m5.2xlarge"},"provider":"openstack"}
2021-01-04T10:10:52.755Z        DEBUG   [processors]    processors/processor.go:120     Generated new processors: add_cloud_metadata={"availability_zone":"us-east-1c","instance":{"id":"i-08f5
36567bd9945df","name":"ip-10-101-2-178.ec2.internal"},"machine":{"type":"m5.2xlarge"},"provider":"openstack"}, add_docker_metadata=[match_fields=[] match_pids=[process.pid, process.ppid]]    
2021-01-04T10:10:52.755Z        INFO    instance/beat.go:392    filebeat stopped.
2021-01-04T10:10:52.755Z        ERROR   instance/beat.go:956    Exiting: data path already locked by another beat. Please make sure that multiple beats are not sharing the same data path (pat
h.data).
Exiting: data path already locked by another beat. Please make sure that multiple beats are not sharing the same data path (path.data).

如您所见,filebeat 因错误而停止:

data path already locked by another beat. Please make sure that multiple beats are not sharing the same data path (path.data).

在 github/forum 中搜索问题后,我发现了这个:
https://discuss.elastic.co/t/data-path-already-locked-by-another-beat/219852/4

这看起来像我的问题, 我使用默认的 filebeat-kubernetes.yaml ,ELK / Filebeats 文档中没有关于如何在 filebeat-kubernetes.yaml
中添加唯一路径的信息 我在哪里添加它们以及如何使它们独一无二? 谢谢

我遇到了同样的问题。这意味着您的数据路径 (/var/lib/filebeats) 被另一个 filebeat 实例锁定。所以执行 sudo systemctl stop filebeat (在我的例子中)以确保你没有 运行ning filebeat 然后 运行 filebeat with sudo filebeat -e 在控制台

中打印日志

我也试过 link,你分享的,但对我没有帮助。这是另一个解决方案,可能会对您有所帮助:https://discuss.elastic.co/t/data-path-already-locked-by-another-beat/219852/2

除了@Anton 的,在其中一种情况下,我在数据路径中有一个锁定文件。根据配置,这可能是 /var/lib/filebeat/filebeat.lock。删除文件和运行sudo filebeat -e

如果你想运行 Elastic stack as a service,解决方案是按以下顺序重新启动所有堆栈:

  • 弹性搜索
  • Kibana
  • Logstash
  • Filebeat

已在 this link 中建议。