Filebeat 没有将日志推送到 Elasticsearch

Filebeat not pushing logs to Elasticsearch

我是 docker 和所有这些日志记录的新手,所以我可能犯了一个愚蠢的错误,所以感谢您提前提供帮助。我有 ELK 运行 一个 docker 容器 (6.2.2) 通过 Dockerfile 行:

FROM sebp/elk:latest

在一个单独的容器中,我通过以下 Dockerfile 行安装和 运行 Filebeat:

RUN curl -L -O -k https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.2.2-amd64.deb
RUN dpkg -i filebeat-6.2.2-amd64.deb
COPY resources/filebeat/filebeat.yml /etc/filebeat/filebeat.yml
RUN chmod go-w /etc/filebeat/filebeat.yml
RUN /usr/share/filebeat/bin/filebeat -e -d "publish" &

我的 Filebeat 配置是:

filebeat.prospectors:
- type: log
  enabled: true
  paths:
    - /jetty/jetty-distribution-9.3.8.v20160314/logs/*.log
output.logstash:
  enabled: false
  hosts: ["elk-stack:9002"]
  #index: 'audit'
output.elasticsearch:
  enabled: true
  hosts: ["elk-stack:9200"]
  #index: "audit-%{+yyyy.MM.dd}"
path.config: "/etc/filebeat"
#setup.template.name: "audit"
#setup.template.pattern: "audit-*"
#setup.template.fields: "${path.config}/fields.yml"

如您所见,我试图在 elasticsearch 中创建自定义索引,但现在我只想让默认值先工作。 jetty日志都有全局读取权限。

docker 容器日志显示没有错误,运行 之后我确保配置和输出正常:

# filebeat test config
Config OK
# filebeat test output
elasticsearch: http://elk-stack:9200...
  parse url... OK
  connection...
    parse host... OK
    dns lookup... OK
    addresses: 172.17.0.3
    dial up... OK
  TLS... WARN secure connection disabled
  talk to server... OK
  version: 6.2.2

/var/log/filebeat/filebeat 显示:

2018-03-15T13:23:38.859Z        INFO    instance/beat.go:468    Home path: [/usr/share/filebeat] Config path: [/etc/filebeat] Data path: [/var/lib/filebeat] Logs path: [/var/log/filebeat]
2018-03-15T13:23:38.860Z        INFO    instance/beat.go:475    Beat UUID: ed5cecaf-cbf5-438d-bbb9-30bab80c4cb9
2018-03-15T13:23:38.860Z        INFO    elasticsearch/client.go:145     Elasticsearch url: http://elk-stack:9200
2018-03-15T13:23:38.891Z        INFO    elasticsearch/client.go:690     Connected to Elasticsearch version 6.2.2

然而,当我点击 localhost:9200/_cat/indices?v 它没有 return 任何索引:

health status index uuid pri rep docs.count docs.deleted store.size pri.store.size

我如何让它工作?我没主意了。再次感谢您的帮助。

要回答我自己的问题,您不能启动 filebeat:

RUN /usr/share/filebeat/bin/filebeat -e -d "publish" &

并让它在容器启动后保持 运行。需要手动启动它或让它在带有 ENTRYPOINT 标记的自己的容器中启动。