docker - Filebeat没有将日志推送到Elasticsearch

标签 docker elasticsearch configuration elastic-stack filebeat

我对Docker和所有这些日志记录都是陌生的,所以也许我犯了一个严重的错误,所以感谢您提前提供帮助。我有ELK通过Dockerfile行运行一个Docker容器(6.2.2):

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时,它不返回任何索引:
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size

我该如何工作?我没主意了。再次感谢任何帮助。

最佳答案

要回答我自己的问题,您不能使用以下命令开始文件拍:

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

并在容器启动后使其继续运行。需要手动启动它,或者使用ENTRYPOINT标记将其启动在自己的容器中。

关于docker - Filebeat没有将日志推送到Elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49300768/

相关文章:

c# - App.config 将嵌套组添加到现有节点

docker - Bitnami 和 Docker

javascript - ElasticSearch跨所有字段的多个索引进行搜索

elasticsearch - 有没有办法像其他编程语言一样用脚本迭代弹性数组文档

elasticsearch - 地理距离过滤器

android - 手机间隙 : How to detect android application is running in development mode

python - 为什么无法在浏览器中访问正在运行的 Docker 容器?

Mysql docker 容器不断重启

docker run 命令结束于 : nginx: [emerg] unknown directive “events” in/etc/nginx/nginx. conf:1

python-3.x - 如何在 google 的 dataproc pyspark 上运行 python3