包含来自容器的日志的日志文件在哪里? [英] Where is a log file with logs from a container?

查看:30
本文介绍了包含来自容器的日志的日志文件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 docker-compose 运行多个容器.我可以使用命令 docker-compose logs 查看应用程序日志.但是,例如,我想访问原始日志文件以将其发送到某个地方?它位于哪里?我想每个容器都有单独的日志(容器内?)但是我在哪里可以找到它?

I am running several containers using docker-compose. I can see application logs with command docker-compose logs. However I would like to access raw log file to send it somewhere for example? Where is it located? I guess it's separate log per each container (inside container?) but where I can find it?

推荐答案

容器的日志可以在:

/var/lib/docker/containers/<container id>/<container id>-json.log

(如果您使用默认的日志格式,即 json)

(if you use the default log format which is json)

这篇关于包含来自容器的日志的日志文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆