This is documentation for the next version of Grafana Alloy Documentation. For the latest stable release, go to the latest version.
otelcol.encoding.text
EXPERIMENTAL: This is an experimental component. Experimental components are subject to frequent breaking changes, and may be removed with no equivalent replacement. To enable and use an experimental component, you must set the
stability.levelflag toexperimental.
otelcol.encoding.text encodes and decodes OpenTelemetry log records as text.
It exposes a handler that compatible otelcol components can use to marshal and unmarshal logs.
Note
otelcol.encoding.textis a wrapper over the upstream OpenTelemetry Collectortextencodingextensionextension. Grafana Labs redirects bug reports or feature requests to the upstream repository when necessary.
You can specify multiple otelcol.encoding.text components by giving them different labels.
Usage
otelcol.encoding.text "<LABEL>" {
}Arguments
You can use the following arguments with otelcol.encoding.text:
The encoding argument selects the character encoding used to decode input into log record bodies.
The component reports an invalid configuration if the upstream extension doesn’t recognize the encoding.
The marshaling_separator argument separates consecutive log record bodies in marshaled output.
The unmarshaling_separator argument is a regular expression that splits input into log records.
If unmarshaling_separator is empty, the decoder waits until it reaches the end of the input and decodes as a single log record.
Blocks
The otelcol.encoding.text component doesn’t support any blocks.
You can configure this component with arguments.
Exported fields
The following fields are exported and can be referenced by other components:
Component health
otelcol.encoding.text is only reported as unhealthy if given an invalid configuration.
Debug information
otelcol.encoding.text doesn’t expose any component-specific debug information.
Debug metrics
otelcol.encoding.text doesn’t expose any component-specific debug metrics.
Examples
otelcol.receiver.awss3
This example uses otelcol.encoding.text to decode UTF-8 log records from S3 objects with keys that end in .txt.
The receiver splits records at one or more blank lines and forwards them to otelcol.exporter.debug:
otelcol.encoding.text "default" {
encoding = "utf8"
unmarshaling_separator = "(\r?\n){2,}"
}
otelcol.receiver.awss3 "default" {
start_time = "2024-01-01 01:00"
end_time = "2024-01-02"
s3downloader {
region = "us-west-1"
s3_bucket = "mybucket"
s3_prefix = "logs"
}
encoding {
extension = otelcol.encoding.text.default.handler
suffix = ".txt"
}
output {
logs = [otelcol.exporter.debug.default.input]
}
}
otelcol.exporter.debug "default" {}