Home Explore Blog Models CI



docker

3rd chunk of `content/manuals/engine/logging/drivers/gelf.md`
9bd813179ff7a74dea936cf30238ff081bfa904690df67740000000100000bad
| `gelf-tcp-max-reconnect`   | optional | `TCP Only` The maximum number of reconnection attempts when the connection drop. A positive integer. Default value is 3.                                                                                                                                                            | `--log-opt gelf-tcp-max-reconnect=3`               |
| `gelf-tcp-reconnect-delay` | optional | `TCP Only` The number of seconds to wait between reconnection attempts. A positive integer. Default value is 1.                                                                                                                                                                     | `--log-opt gelf-tcp-reconnect-delay=1`             |
| `tag`                      | optional | A string that's appended to the `APP-NAME` in the `gelf` message. By default, Docker uses the first 12 characters of the container ID to tag log messages. Refer to the [log tag option documentation](log_tags.md) for customizing the log tag format.                             | `--log-opt tag=mailer`                             |
| `labels`                   | optional | Applies when starting the Docker daemon. A comma-separated list of logging-related labels this daemon accepts. Adds additional key on the `extra` fields, prefixed by an underscore (`_`). Used for advanced [log tag options](log_tags.md).                                        | `--log-opt labels=production_status,geo`           |
| `labels-regex`             | optional | Similar to and compatible with `labels`. A regular expression to match logging-related labels. Used for advanced [log tag options](log_tags.md).                                                                                                                                    | `--log-opt labels-regex=^(production_status\|geo)` |
| `env`                      | optional | Applies when starting the Docker daemon. A comma-separated list of logging-related environment variables this daemon accepts. Adds additional key on the `extra` fields, prefixed by an underscore (`_`). Used for advanced [log tag options](log_tags.md).                         | `--log-opt env=os,customer`                        |
| `env-regex`                | optional | Similar to and compatible with `env`. A regular expression to match logging-related environment variables. Used for advanced [log tag options](log_tags.md).                                                                                                                        | `--log-opt env-regex=^(os\|customer)`              |

> [!NOTE]
>
> The `gelf` driver doesn't support TLS for TCP connections. Messages sent to TLS-protected inputs can silently fail.

### Examples

This example configures the container to use the GELF server running at
`192.168.0.42` on port `12201`.

```console
$ docker run -dit \
    --log-driver=gelf \
    --log-opt gelf-address=udp://192.168.0.42:12201 \
    alpine sh
```

Title: GELF Logging Driver Options and Examples
Summary
This section continues detailing options for the GELF logging driver, including `gelf-tcp-max-reconnect`, `gelf-tcp-reconnect-delay`, `tag`, `labels`, `labels-regex`, `env`, and `env-regex`. It also notes that the `gelf` driver does not support TLS for TCP connections. The section concludes with an example Docker command that configures a container to use the GELF server at a specified address.