非常教程

Docker 17参考手册

引擎: 管理员指南 | Engine: Admin Guide

ETW日志记录驱动程序(引擎) | ETW logging driver (Engine)

ETW 日志记录驱动程序将容器日志转发为 ETW 事件。ETW 代表 Windows 中的事件跟踪,是用于在 Windows 中跟踪应用程序的通用框架。每个 ETW 事件都包含一条包含日志及其环境信息的消息。然后客户端可以创建一个 ETW 侦听器来侦听这些事件。

此日志记录驱动程序在 Windows 中注册的 ETW 提供程序具有以下 GUID 标识符:{a3693192-9ed6-46d2-a981-f8226c8363bd}。客户端创建一个 ETW 侦听器并注册以侦听来自日志驱动程序提供者的事件。提供者和监听者的创建顺序无关紧要。客户可以在向系统注册提供商之前创建自己的 ETW 监听器,并开始监听来自提供商的事件。

用法

以下是如何使用大多数 Windows 安装中包含的 logman 实用程序来监听这些事件的示例:

1. logman start -ets DockerContainerLogs -p {a3693192-9ed6-46d2-a981-f8226c8363bd} 0 0 -o trace.etl

1. 使用 etwlogs 驱动程序运行您的容器,通过添加--log-driver=etwlogs到 Docker 运行命令并生成日志消息。

2. logman stop -ets DockerContainerLogs

2. 这将生成一个包含事件的 etl 文件。将此文件转换为可读格式的一种方法是运行:tracerpt -y trace.etl

每个 ETW 事件都将包含这种格式的结构化消息字符串:

container_name: %s, image_name: %s, container_id: %s, image_id: %s, source: [stdout | stderr], log: %s

有关邮件中每个项目的详细信息可以在下面找到:

字段

描述

container_name

容器名称在启动时。

image_nameE

容器图像的名称。

container_id

完整的64个字符的容器 ID。

image_id

容器图像的完整 ID。

source

stdout 或 stderr。

log

容器日志消息。

以下是一个示例事件消息:

container_name: backstabbing_spence,
image_name: windowsservercore,
container_id: f14bb55aa862d7596b03a33251c1be7dbbec8056bbdead1da8ec5ecebbe29731,
image_id: sha256:2f9e19bd998d3565b4f345ac9aaf6e3fc555406239a4fb1b1ba879673713824b,
source: stdout,
log: Hello world!

客户端可以解析此消息字符串以获取日志消息以及其环境信息。请注意,时间戳在 ETW 事件中也可用。

注意:此 ETW 提供程序仅发出消息字符串,而不是特定结构的 ETW 事件。因此,不需要向系统注册清单文件来读取和解释其 ETW 事件。

ETW, docker, logging, driver

引擎: 管理员指南 | Engine: Admin Guide相关

1.Amazon CloudWatch记录日志记录驱动程序(引擎) | Amazon CloudWatch logs logging driver (Engine)
2. 绑定挂载 | Bind mounts (Engine)
3.使用Prometheus(引擎)收集Docker指标 | Collect Docker metrics with Prometheus (Engine)
4.配置和运行Docker(引擎) | Configuring and running Docker (Engine)
5.配置日志记录驱动程序 | Configuring logging drivers (Engine)
6.使用systemd控制和配置Docker(引擎) | Control and configure Docker with systemd (Engine)
7.流利的日志驱动程序(引擎) | Fluentd logging driver (Engine)
8.格式化命令和日志输出(引擎) | Format command and log output (Engine)
9.Google Cloud日志记录驱动程序(引擎) | Google Cloud logging driver (Engine)
10.Graylog扩展格式(GELF)日志记录驱动程序(引擎) | Graylog Extended Format (GELF) logging driver (Engine)
11.Journald日志记录驱动程序(引擎) | Journald logging driver (Engine)
12.JSON文件日志记录驱动程序(引擎) | JSON File logging driver (Engine)
13.在守护进程停机期间保持容器处于活动状态(引擎) | Keep containers alive during daemon downtime (Engine)
14.限制容器的资源(引擎) | Limit a container's resources (Engine)
15.通过大使容器链接(引擎) | Link via an ambassador container (Engine)
16.记录驱动程序的日志标记(引擎) | Log tags for logging driver (Engine)
17.Logentries日志驱动程序(引擎) | Logentries logging driver (Engine)
18.PowerShell DSC用法(引擎) | PowerShell DSC usage (Engine)
19.修剪未使用的Docker对象(引擎) | Prune unused Docker objects (Engine)
20.在容器中运行多个服务(引擎) | Run multiple services in a container (Engine)
21.运行时指标(引擎) | Runtime metrics (Engine)
22.Splunk日志记录驱动程序(引擎) | Splunk logging driver (Engine)
23.自动启动容器(引擎) | Start containers automatically (Engine)
24.存储概述(引擎) | Storage overview (Engine)
25.Syslog日志记录驱动程序(引擎) | Syslog logging driver (Engine)
26.tmpfs mounts
27.解决卷问题(引擎) | Troubleshoot volume problems (Engine)
28.使用日志驱动程序插件(引擎) | Use a logging driver plugin (Engine)
29.使用Ansible(引擎) | Using Ansible (Engine)
30.使用Chef(引擎) | Using Chef (Engine)
31.使用Puppet(引擎) | Using Puppet (Engine)
32.查看容器的日志(引擎) | View a container's logs (Engine)
33.Volumes (Engine)
Docker 17

Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。

主页 https://docker.com/
源码 https://github.com/docker/docker
版本 17
发布版本 17.06