Home Explore Blog CI



docker

1st chunk of `content/manuals/engine/logging/drivers/journald.md`
226bb0ea77a3fd29a31ad68b495ff10acd258b1152d304160000000100000dc5
---
description: Learn how to use the Journald logging driver with Docker Engine
keywords: journald, systemd-journald, docker, logging, driver
title: Journald logging driver
aliases:
  - /engine/reference/logging/journald/
  - /engine/admin/logging/journald/
  - /config/containers/logging/journald/
---

The `journald` logging driver sends container logs to the
[`systemd` journal](https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html).
Log entries can be retrieved using the `journalctl` command, through use of the
`journal` API, or using the `docker logs` command.

In addition to the text of the log message itself, the `journald` log driver
stores the following metadata in the journal with each message:

| Field                                | Description                                                                                                                                           |
| :----------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CONTAINER_ID`                       | The container ID truncated to 12 characters.                                                                                                          |
| `CONTAINER_ID_FULL`                  | 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 isn't reflected in the journal entries. |
| `CONTAINER_TAG`, `SYSLOG_IDENTIFIER` | The container tag ([log tag option documentation](log_tags.md)).                                                                                      |
| `CONTAINER_PARTIAL_MESSAGE`          | A field that flags log integrity. Improve logging of long log lines.                                                                                  |
| `IMAGE_NAME`                         | The name of the container image.                                                                                                                      |

## Usage

To use the `journald` driver as the default logging driver, set the `log-driver`
and `log-opts` 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](/reference/cli/dockerd.md#daemon-configuration-file).

The following example sets the log driver to `journald`:

```json
{
  "log-driver": "journald"
}
```

Restart Docker for the changes to take effect.

To configure the logging driver for a specific container, use the `--log-driver`
flag on the `docker run` command.

```console
$ docker run --log-driver=journald ...
```

## Options

Use the `--log-opt NAME=VALUE` flag to specify additional `journald` logging
driver options.

| Option         | Required | Description                                                                                                                                                                   |
| :------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

Title: Journald Logging Driver for Docker
Summary
The journald logging driver in Docker sends container logs to the systemd journal, allowing retrieval via `journalctl`, the journal API, or `docker logs`. It stores metadata like container ID, name, tag, and image name alongside the log messages. To use it, configure the `log-driver` in `daemon.json` or use the `--log-driver` flag with `docker run`. Additional options can be specified using `--log-opt`.