mirror of https://github.com/docker/docs.git
chore: tier 1 freshness: content/config/containers/logging/log_tags.md
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
b72a52fa7c
commit
c96099275a
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
description: Describes how to format tags for.
|
description: Learn about how to format log output with Go templates
|
||||||
keywords: docker, logging, driver, syslog, Fluentd, gelf, journald
|
keywords: docker, logging, driver, syslog, Fluentd, gelf, journald
|
||||||
title: Customize log driver output
|
title: Customize log driver output
|
||||||
aliases:
|
aliases:
|
||||||
|
|
@ -17,18 +17,15 @@ $ docker run --log-driver=fluentd --log-opt fluentd-address=myhost.local:24224 -
|
||||||
|
|
||||||
Docker supports some special template markup you can use when specifying a tag's value:
|
Docker supports some special template markup you can use when specifying a tag's value:
|
||||||
|
|
||||||
|
|
||||||
| Markup | Description |
|
| Markup | Description |
|
||||||
|--------------------|------------------------------------------------------|
|
| ------------------ | ---------------------------------------------------- |
|
||||||
| `{{.ID}}` | The first 12 characters of the container ID. |
|
| `{{.ID}}` | The first 12 characters of the container ID. |
|
||||||
| `{{.FullID}}` | The full container ID. |
|
| `{{.FullID}}` | The full container ID. |
|
||||||
| `{{.Name}}` | The container name. |
|
| `{{.Name}}` | The container name. |
|
||||||
| `{{.ImageID}}` | The first 12 characters of the container's image ID. |
|
| `{{.ImageID}}` | The first 12 characters of the container's image ID. |
|
||||||
| `{{.ImageFullID}}` | The container's full image ID. |
|
| `{{.ImageFullID}}` | The container's full image ID. |
|
||||||
| `{{.ImageName}}` | The name of the image used by the container. |
|
| `{{.ImageName}}` | The name of the image used by the container. |
|
||||||
| `{{.DaemonName}}` | The name of the docker program (`docker`). |
|
| `{{.DaemonName}}` | The name of the Docker program (`docker`). |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
For example, specifying a `--log-opt tag="{{.ImageName}}/{{.Name}}/{{.ID}}"` value yields `syslog` log lines like:
|
For example, specifying a `--log-opt tag="{{.ImageName}}/{{.Name}}/{{.ID}}"` value yields `syslog` log lines like:
|
||||||
|
|
||||||
|
|
@ -37,6 +34,6 @@ Aug 7 18:33:19 HOSTNAME hello-world/foobar/5790672ab6a0[9103]: Hello from Docke
|
||||||
```
|
```
|
||||||
|
|
||||||
At startup time, the system sets the `container_name` field and `{{.Name}}` in
|
At startup time, the system sets the `container_name` field and `{{.Name}}` in
|
||||||
the tags. If you use `docker rename` to rename a container, the new name is not
|
the tags. If you use `docker rename` to rename a container, the new name isn't
|
||||||
reflected in the log messages. Instead, these messages continue to use the
|
reflected in the log messages. Instead, these messages continue to use the
|
||||||
original container name.
|
original container name.
|
||||||
Loading…
Reference in New Issue