mirror of https://github.com/docker/docs.git
chore: tier 1 freshness: content/config/containers/logging/fluentd.md
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
33d73761d7
commit
d82daa0186
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
description: Describes how to use the fluentd logging driver.
|
||||
description: Learn how to use the fluentd logging driver
|
||||
keywords: Fluentd, docker, logging, driver
|
||||
title: Fluentd logging driver
|
||||
aliases:
|
||||
- /engine/reference/logging/fluentd/
|
||||
- /reference/logging/fluentd/
|
||||
- /engine/admin/logging/fluentd/
|
||||
- /engine/reference/logging/fluentd/
|
||||
- /reference/logging/fluentd/
|
||||
- /engine/admin/logging/fluentd/
|
||||
---
|
||||
|
||||
The `fluentd` logging driver sends container logs to the
|
||||
|
|
@ -18,40 +18,38 @@ In addition to the log message itself, the `fluentd` log
|
|||
driver sends the following metadata in the structured log message:
|
||||
|
||||
| Field | Description |
|
||||
|:-----------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| :--------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `container_id` | The full 64-character container ID. |
|
||||
| `container_name` | The container name at the time it was started. If you use `docker rename` to rename a container, the new name is not reflected in the journal entries. |
|
||||
| `container_name` | The container name at the time it was started. If you use `docker rename` to rename a container, the new name isn't reflected in the journal entries. |
|
||||
| `source` | `stdout` or `stderr` |
|
||||
| `log` | The container log |
|
||||
|
||||
The `docker logs` command is not available for this logging driver.
|
||||
The `docker logs` command isn't available for this logging driver.
|
||||
|
||||
## Usage
|
||||
|
||||
Some options are supported by specifying `--log-opt` as many times as needed:
|
||||
|
||||
- `fluentd-address`: specify a socket address to connect to the Fluentd daemon, ex `fluentdhost:24224` or `unix:///path/to/fluentd.sock`
|
||||
- `tag`: specify a tag for fluentd message, which interprets some markup, ex `{{.ID}}`, `{{.FullID}}` or `{{.Name}}` `docker.{{.ID}}`
|
||||
- `fluentd-address`: specify a socket address to connect to the Fluentd daemon, ex `fluentdhost:24224` or `unix:///path/to/fluentd.sock`.
|
||||
- `tag`: specify a tag for Fluentd messages. Supports some Go template markup, ex `{{.ID}}`, `{{.FullID}}` or `{{.Name}}` `docker.{{.ID}}`.
|
||||
|
||||
|
||||
To use the `fluentd` driver as the default logging driver, set the `log-driver`
|
||||
and `log-opt` keys to appropriate values in the `daemon.json` file, which is
|
||||
located in `/etc/docker/` on Linux hosts or
|
||||
`C:\ProgramData\docker\config\daemon.json` on Windows Server. For more about
|
||||
+configuring Docker using `daemon.json`, see
|
||||
+[daemon.json](../../../engine/reference/commandline/dockerd.md#daemon-configuration-file).
|
||||
To use the `fluentd` driver as the default logging driver, set the `log-driver`
|
||||
and `log-opt` keys to appropriate values in the `daemon.json` file, which is
|
||||
located in `/etc/docker/` on Linux hosts or
|
||||
`C:\ProgramData\docker\config\daemon.json` on Windows Server. For more about
|
||||
configuring Docker using `daemon.json`, see [daemon.json](../../../engine/reference/commandline/dockerd.md#daemon-configuration-file).
|
||||
|
||||
The following example sets the log driver to `fluentd` and sets the
|
||||
`fluentd-address` option.
|
||||
|
||||
```json
|
||||
{
|
||||
```json
|
||||
{
|
||||
"log-driver": "fluentd",
|
||||
"log-opts": {
|
||||
"fluentd-address": "fluentdhost:24224"
|
||||
}
|
||||
}
|
||||
```
|
||||
}
|
||||
```
|
||||
|
||||
Restart Docker for the changes to take effect.
|
||||
|
||||
|
|
@ -65,13 +63,17 @@ Restart Docker for the changes to take effect.
|
|||
To set the logging driver for a specific container, pass the
|
||||
`--log-driver` option to `docker run`:
|
||||
|
||||
docker run --log-driver=fluentd ...
|
||||
```text
|
||||
docker run --log-driver=fluentd ...
|
||||
```
|
||||
|
||||
Before using this logging driver, launch a Fluentd daemon. The logging driver
|
||||
connects to this daemon through `localhost:24224` by default. Use the
|
||||
`fluentd-address` option to connect to a different address.
|
||||
|
||||
docker run --log-driver=fluentd --log-opt fluentd-address=fluentdhost:24224
|
||||
```text
|
||||
docker run --log-driver=fluentd --log-opt fluentd-address=fluentdhost:24224
|
||||
```
|
||||
|
||||
If container cannot connect to the Fluentd daemon, the container stops
|
||||
immediately unless the `fluentd-async` option is used.
|
||||
|
|
@ -97,7 +99,6 @@ By default, Docker uses the first 12 characters of the container ID to tag log m
|
|||
Refer to the [log tag option documentation](log_tags.md) for customizing
|
||||
the log tag format.
|
||||
|
||||
|
||||
### labels, labels-regex, env, and env-regex
|
||||
|
||||
The `labels` and `env` options each take a comma-separated list of keys. If
|
||||
|
|
@ -128,7 +129,7 @@ How long to wait between retries. Defaults to 1 second.
|
|||
|
||||
### fluentd-max-retries
|
||||
|
||||
The maximum number of retries. Defaults to `4294967295` (2**32 - 1).
|
||||
The maximum number of retries. Defaults to `4294967295` (2\*\*32 - 1).
|
||||
|
||||
### fluentd-sub-second-precision
|
||||
|
||||
|
|
@ -150,6 +151,7 @@ aggregate store.
|
|||
|
||||
1. Write a configuration file (`test.conf`) to dump input logs:
|
||||
|
||||
```none
|
||||
<source>
|
||||
@type forward
|
||||
</source>
|
||||
|
|
@ -157,11 +159,16 @@ aggregate store.
|
|||
<match *>
|
||||
@type stdout
|
||||
</match>
|
||||
```none
|
||||
|
||||
2. Launch Fluentd container with this configuration file:
|
||||
|
||||
```none
|
||||
$ docker run -it -p 24224:24224 -v /path/to/conf/test.conf:/fluentd/etc/test.conf -e FLUENTD_CONF=test.conf fluent/fluentd:latest
|
||||
```
|
||||
|
||||
3. Start one or more containers with the `fluentd` logging driver:
|
||||
|
||||
```none
|
||||
$ docker run --log-driver=fluentd your/application
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue