[英]Docker filebeat autodiscover not detecting nginx logs
在我的 Mac 上,我在 docker 文件和 docker 文件中運行 nginx 文件。
docker run -p 80:80 nginx
上面的命令成功運行了 nginx ,我可以在瀏覽器中訪問它,並且 output 打印到控制台。
這是我正在構建然后運行的 docker 文件:
FROM docker.elastic.co/beats/filebeat:7.8.0
COPY filebeat.yml /usr/share/filebeat/filebeat.yml
USER root
這是我上面引用的 filebeat.yml:
filebeat.autodiscover:
providers:
- type: docker
templates:
- condition:
contains:
docker.container.image: nginx
config:
- type: docker
containers.ids:
- "${data.docker.container.id}"
- module: nginx
access:
enabled: true
containers:
stream: "stdout"
error:
enabled: true
containers:
stream: "stderr"
output.console:
pretty: true
我使用以下命令運行 filebeat docker 圖像:
sudo docker run -it -v /var/run/docker.sock:/var/run/docker.sock filebeat
docker.sock 的東西是因為無法連接到 docker 套接字錯誤我得到(某種 docker 用戶錯誤權限我推測)。
以上所有內容都在 docker 容器內運行 filebeat。
INFO [autodiscover] autodiscover/autodiscover.go:113 Starting autodiscover manager
但是,當我在瀏覽器中訪問 localhost 並觸發 nginx 日志時,唯一的 output 是每隔 30 秒偶爾出現的 docker 系統指標:
{"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":40,"time":{"ms":43}},"total":{"ticks":100,"time":{"ms":109},"value":100},"user":{"ticks":60,"time":{"ms":66}}},"handles":{"limit":{"hard":1048576,"soft":1048576},"open":8},"info":{"ephemeral_id":"d3e79d62-6949-4d79-89e8-c595332c18ed","uptime":{"ms":30054}},"memstats":{"gc_next":10249440,"memory_alloc":5520104,"memory_total":17591608,"rss":55390208},"runtime":{"goroutines":23}},"filebeat":{"harvester":{"open_files":0,"running":0}},"libbeat":{"config":{"module":{"running":0}},"output":{"type":"console"},"pipeline":{"clients":0,"events":{"active":0}}},"registrar":{"states":{"current":0},"writes":{"success":1,"total":1}},"system":{"cpu":{"cores":2},"load":{"1":0,"15":0,"5":0,"norm":{"1":0,"15":0,"5":0}}}}}}
未檢測到 nginx 日志。
這是我收到的潛在相關警告:
Filebeat is unable to load the Ingest Node pipelines for the configured modules because the Elasticsearch output is not configured/enabled
編輯:我認為這是問題的症結所在,收割機沒有找到任何日志:
filebeat":{"harvester":{"open_files":0,"running":0}}
Edit2:問題的根本原因似乎是在 Mac 上終端無法訪問日志文件:不是它們在 Mac 上的存儲位置......所以在 docker 之間似乎不支持在 mac 上運行 filebeat
Mac 上的 Filebeat 不支持收集 docker 日志:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.