How to Forward Logs to an OpenTelemetry (OTLP) Endpoint
LogForward has no typed otlp output. To ship platform logs to an OpenTelemetry backend (an OpenTelemetry Collector, or any vendor that accepts OTLP/HTTP), use an advancedSink output with:
- one
rawTransformsremapentry that turns each platform log record into a complete OTLPExportLogsServiceRequest(resourceLogs→scopeLogs→logRecords), and - an
httpsink withencoding.codec: otlp, which serialises that structure as OTLP protobuf and POSTs it to/v1/logs.
For the general advancedSink / rawTransforms contract, see How to Forward Logs with advancedSink and rawTransforms.
TOC
PrerequisitesHow It WorksWhy protobuf (codec: otlp) rather than JSONExampleSink parametersField mappingAuthenticationVerifyTroubleshootingRelated TopicsPrerequisites
- Alauda Container Platform Log Storage Management installed, and
PlatformLogForward/platform-defaultisReady. See Installation. - The storage operator carries
advancedSink.rawTransforms(v4.4 release). - The destination exposes OTLP/HTTP (default port
4318). OTLP/gRPC (port4317) is not supported.
LogForward lives in cpaas-system only
The admission webhook validate-lf.log.alauda.io rejects any LogForward outside cpaas-system. Secrets referenced by the CR must also live in cpaas-system.
How It Works
Why protobuf (codec: otlp) rather than JSON
When the http sink batches JSON events, it serialises the batch as a JSON array ([{...},{...}]). OTLP/HTTP JSON requires a single top-level {"resourceLogs": [...]} object, so any batch larger than one event is rejected by the receiver. Protobuf has no such restriction: concatenating encoded messages of the same type is equivalent to merging their repeated fields, so a batch of N concatenated ExportLogsServiceRequest messages decodes as one valid request carrying N resourceLogs.
codec: otlp does not map events for you
The otlp codec only encodes events that already have the OTLP structure at the top level. A platform log record that reaches the sink without being reshaped fails with Log event does not contain OTLP top-level fields and is dropped. The operator's vector validate pre-flight does not catch this — it only appears at runtime in the Vector pod logs. The remap below is therefore mandatory.
Example
Sink parameters
The operator adds the sink buffer and acknowledgements blocks itself; these keys are reserved and cannot be set in parameters.
Field mapping
The remap receives platform log records from Kafka as written by nevermore, after the operator has stripped the Kafka metadata fields.
Notes on the mapping:
- Attributes with an empty value are omitted, so records without pod metadata (for example node system logs) do not carry empty-string attributes.
- Platform log records carry no severity field, so the example does not set
severityText/severityNumber. To add one, parse it out oflog_datain the sameremap. - Every record carries its own copy of the resource attributes, so requests are larger than they would be if records were grouped by resource. The attributes on each record are the same either way.
- The
remapreplaces the whole event (. = {...}). Keep it as the lastrawTransformsentry, and read every field you need before that assignment. Platformfilters[]and earlierrawTransformsentries (for examplefilterorsample) can run before it as usual. - Event (
type: event) and audit (type: audit) inputs have different fields; this mapping does not apply to them.
Authentication
Put the token in a Secret in cpaas-system under the password key, reference it with authSecretRef, and use ${OUTPUT_PASSWORD} in a request header. The username key is not used by this sink and can be omitted.
For an https:// endpoint whose certificate is issued by a publicly trusted CA, no further TLS configuration is needed.
With componentType: http, setting spec.output.tls currently makes the operator pre-flight fail with unknown field 'enabled', and the LogForward stays Ready=False. Until this is fixed, endpoints that require a private CA (tls.caSecretRef) or a client certificate (tls.clientCertSecretRef) cannot be configured through this page.
Verify
Ready=True only means the Vector Deployment is running. Confirm delivery on the receiving side: before switching to the production backend, point uri at an OpenTelemetry Collector with the debug exporter enabled and check that records arrive with the expected resource attributes and timestamps.
Troubleshooting
Related Topics
- How to Forward Logs with
advancedSinkandrawTransforms— the fulladvancedSinkcontract and other recipes. - How to Forward Logs to an External System with LogForward — typed outputs and platform filters.