Journald Receiver
contrib, k8s
Maintainers: @belimawr, @namco1992
Source: opentelemetry-collector-contrib
Supported Telemetry
Overview
Prerequisites
The journald receiver has specific requirements that must be met:journalctl Binary Requirement
The journald receiver requires the journalctl binary to be available in the container or on the system. This is because the receiver uses journalctl to read logs from the systemd journal. The receiver does not implement its own journal reading logic and relies on journalctl for this functionality. If running the collector in a container, the journalctl binary should match the host system, and this receiver should be configured with theroot_path/journalctl_path options so that the journalctl from the host is used.
Permissions
- The collector’s user must have sufficient permissions to access the journal through
journalctl - In containerized environments, this typically requires root privileges and specific capabilities (see Kubernetes Security)
Configuration
Operators
Each operator performs a simple responsibility, such as parsing a timestamp or JSON. Chain together operators to process logs into a desired format.- Every operator has a
type. - Every operator can be given a unique
id. If you use the same type of operator more than once in a pipeline, you must specify anid. Otherwise, theiddefaults to the value oftype. - Operators will output to the next operator in the pipeline. The last operator in the pipeline will emit from the receiver. Optionally, the
outputparameter can be used to specify theidof another operator to which logs will be passed directly. - Only parsers and general purpose operators should be used.
Example Configurations
Minimal configuration
The following configuration is the minimal configuration to read journald logs:journalctl ... --priority info. This will read the 10 most recent entries and
any subsequent entry. --priority info is the default priority, the
following examples will omit it for simplicity.
Cursor tracking
Reading from the beginning
journalctl ... --no-tail. This will read all messages from the current boot.
Units
Matches
The following configuration:journalctl as the following arguments: journalctl ... _SYSTEMD_UNIT=ssh + _SYSTEMD_UNIT=kubelet _UID=1000,
which is going to retrieve all entries which match at least one of the following rules:
_SYSTEMD_UNITisssh_SYSTEMD_UNITiskubeletand_UIDis1000
Multiple filtering options
In case of using multiple following options, conditions between them are logicallyANDed and within them are logically ORed:
journalctl as the following arguments
journalctl ... --priority=info --unit=kubelet --unit=systemd --identifier=systemd _SYSTEMD_UNIT=ssh + _SYSTEMD_UNIT=kubelet _UID=1000,
which is going to effectively retrieve all entries which matches the following set of rules:
-
_PRIORITYis6, and -
_SYSTEMD_UNITiskubeletorsystemd, and -
SYSLOG_IDENTIFIERsystemd, and -
entry matches at least one of the following rules:
_SYSTEMD_UNITisssh_SYSTEMD_UNITiskubeletand_UIDis1000
Performance Considerations
start_at parameter
Thestart_at configuration parameter has significant performance implications:
end(default - recommended for production): Reads only new entries after collector start- Minimal startup impact
- No historical log replay
beginning: Reads entire journal history (potentially GBs of logs)- Use only for testing or initial backfill
- Can cause 10-60 second startup delay
- High CPU/memory usage during catchup
Unit Filtering Impact
- Unfiltered: Reads all systemd units
- Filtered: Reads only specified units
Setup and Deployment
Journal Location in Container Environments
Journal file locations differ between traditional systems and containerized environments: Traditional Systems:- Persistent journal:
/var/log/journal/ - Requires
Storage=persistentin journald.conf
- Volatile journal:
/run/log/journal/ - Default
Storage=volatileorStorage=autowith missing/var/log/journal
Docker & Kubernetes
When running otelcol in a container, you need:- Root permissions (journal files are root-owned)
- The journal directory mounted (usually
/run/log/journalin containerized environments) - The
journalctlbinary available
Option 1: Bundle journalctl in your image (Recommended)
Build a collector image that includes journalctl. See the exampleDockerfile in examples/container with step-by-step instructions for Kubernetes deployments.
This works well if your hosts run similar systemd versions.
Option 2: Use host’s journalctl via chroot
Some collector containers need to work across a variety of arbitrary hosts that may be running mutually incompatible versions of journalctl, making it difficult to select a single version of journalctl to bundle into the container. One way to solve this problem is to ensure that the collector running in the container invokes the exact same journalctl that was used to write the logs in the first place. To achieve this, you can mount the host’s rootfs to the container and then configure the receiver to run the host’s journalctl in a chroot for that mount. You can pass-v /:/host to docker run to mount the host’s rootfs:
root_path to use that mount as a chroot for journalctl. Due to a Go issue, running executables from $PATH does not work well in a chroot, so you must also use journalctl_path to configure a full path to journalctl inside of the chroot:
Linux packaging
When installing otelcol as a linux package, you will most likely need to add theotelcol-contrib or otel user to the systemd-journal group. The exact user and group might vary depending on your package and linux distribution of choice.
You can test if the user has sufficient permissions by running something like (you might need to adjust according to available shell and opentelemetry user)
Troubleshooting
Kubernetes Security Requirements
Minimum Requirements:- Run as root (
runAsUser: 0) - journal files are root-owned - Read access to
/run/log/journal(requires root permission level) - Required capabilities:
CAP_DAC_READ_SEARCH: Read any file regardless of permissionsCAP_SYS_PTRACE: Required by journalctl for some operations
Common Errors and Solutions
Diagnostic Commands
Configuration
Example Configuration
Last generated: 2026-08-24