Skip to main content

Otlpjsonfile Receiver

Status Available in: contrib Maintainers: @atoulme Source: opentelemetry-collector-contrib

Supported Telemetry

Logs Metrics Traces

Overview

The receiver will watch the directory and read files. If a file is updated or added, the receiver will read it in its entirety again. The data is serialized according to the OpenTelemetry Protocol File Exporter.

Getting Started

The following settings are required:
  • include: set a glob path of files to include in data collection
Example:
[!NOTE] The deprecated component type otlpjsonfile (without the underscores) can still be used as an alias and will log a deprecation warning.

Configuration

Supported encodings

Other less common encodings are supported on a best-effort basis. See https://www.iana.org/assignments/character-sets/character-sets.xhtml for other encodings available.

Time parameters

All time parameters must have the unit of time specified. e.g.: 200ms, 1s, 1m.

Handling Copytruncate Rotation

When log files are rotated using the copytruncate strategy (where the file is copied and then truncated in place), the receiver can detect when a file has been truncated by comparing the stored offset with the current file size. The on_truncate setting controls how the receiver behaves when truncation is detected:
  • ignore (default): The receiver keeps the original offset and will not read any data until the file grows past the original offset. This prevents duplicate log ingestion when a file is rotated.
  • read_whole_file: The receiver resets the offset to 0 and reads the entire file from the beginning. Use this mode when you want to ensure no data loss, even if it means potentially re-reading some logs.
  • read_new: The receiver updates the offset to the current file size (the position after truncation). This allows reading new data that is written after the truncation without re-reading existing content.
Example configuration:

Configuration

Example Configuration


Last generated: 2026-08-24