【发布时间】:2020-01-04 21:09:35
【问题描述】:
在通过 Windows 10 上的“Windows 子系统 Linux 2”运行 Ubuntu 18.04 的本地计算机上,我正在运行 Elastic 7.3、Kibana 7.3 和 Elastic 7.3 docker 容器。
设置成功,Filebeat 似乎可以正确监控容器。但是,Kibana 不显示任何日志。
设置
要设置 Elastic 和 Kibana,我使用以下命令
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.3.1
docker run --network=lognetwork --name=elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.3.1
docker pull docker.elastic.co/kibana/kibana:7.3.1
docker run --name=kibana --network=lognetwork -e ELASTICSEARCH_HOSTS=http://elasticsearch:9200 -p 5601:5601 docker.elastic.co/kibana/kibana:7.3.1
在这两个命令之后,来自 Kibana 容器的日志显示它已成功连接到 Elastic:
{"type":"log","@timestamp":"2019-09-01T13:22:18Z","tags":["status","plugin:spaces@7.3.1","info"],"pid":6,"state":"green","message":"Status changed from yellow to green - Ready","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}
我还可以访问 http://localhost:5601 上的 Kibana 仪表板以及 http://localhost:9200 上的 Elastic 两者都正常运行
然后我设置了 filebeat:
docker run --network=lognetwork docker.elastic.co/beats/filebeat:7.3.1 setup -E setup.kibana.host=kibana:5601 -E output.elasticsearch.hosts=["elasticsearch:9200"]
我可以看到 Elastic 和 Kibana 容器日志并返回 200。Filebeat 容器上的日志显示:
Index setup finished.
Loading dashboards (Kibana must be running and reachable)
Loaded dashboards
Loaded machine learning job configurations
Loaded Ingest pipelines
最后,我从 Elastic 站点拉取默认配置,启动 Filebeat 并附加到容器
curl -L -O https://raw.githubusercontent.com/elastic/beats/7.3/deploy/docker/filebeat.docker.yml
docker run -d --network=lognetwork --name=filebeat --user=root --volume="$(pwd)/filebeat.docker.yml:/usr/share/filebeat/filebeat.yml:ro" --volume="/var/lib/docker/containers:/var/lib/docker/containers:ro" --volume="/var/run/docker.sock:/var/run/docker.sock:ro" docker.elastic.co/beats/filebeat:7.3.1 filebeat -e -strict.perms=false -E output.elasticsearch.hosts=["elasticsearch:9200"]
docker attach filebeat
我可以看到 Filebeat 发送监控脉冲,但是当它发送时,弹性日志不会显示任何新内容。
为了测试,我启动了 Docker “hello-world”,它会生成几行日志
docker run hello-world
Filebeat 显示如下日志
2019-09-01T13:30:40.624Z INFO log/input.go:148 Configured paths: [/var/lib/docker/containers/460cc8c215ff69ecf28685c9cf89c0e56d0b3e4f680b8bf29beb5b570ebb7a14/*-json.log]
2019-09-01T13:30:40.624Z INFO input/input.go:114 Starting input of type: container; ID: 16402101064670842079
结果:
Kibana 没有显示日志。单击“检查新数据”也不显示任何内容。
文件夹 /var/lib/docker/containers 也是空的。 filebeat 日志返回的路径(/var/lib/docker/containers/460cc8c215ff69ecf28685c9cf89c0e56d0b3e4f680b8bf29beb5b570ebb7a14/)似乎不存在。
预期:
- Kibana 显示“hello world”docker 容器日志
- 在 /var/lib/docker/containers 下查看日志文件
我错过了什么?
谢谢你,
奥利维尔
【问题讨论】:
标签: docker elasticsearch kibana windows-subsystem-for-linux filebeat