How to Forward Logs to an External System with LogForward
The LogForward custom resource lets tenants forward the platform's log stream to an external system (Elasticsearch, OpenSearch, Loki, syslog, HTTP, ClickHouse, Kafka, console, or an advanced-sink escape hatch), independently of the platform's built-in storage operator. Each CR reads the platform's Kafka topics and produces one Vector Deployment.
LogForward is separate from and does not replace the platform's storage pipeline. Records still land in the storage cluster's ClickHouse or OpenSearch as usual; LogForward produces an additional copy.
The authoritative CRD source is api/v1alpha1/logforward_types.go in log-storage-operator. The samples below are trimmed from config/samples/logforward_*.yaml.
TOC
PrerequisitesSpec shapeCommon RecipesMirror the platform's log and audit streams to a user KafkaForward the platform's log stream to a user OpenSearch, with prune and redactForward audit records to an HTTP intakeShip a namespace's log stream to a syslog collectorVerifyLimits and NotesRelated TopicsPrerequisites
- The storage cluster the tenant lives on has Alauda Container Platform Log Storage Management installed and
PlatformLogForward/platform-defaultisReady. See Installation. - The external destination is reachable from the storage cluster's
cpaas-systemnamespace. - Any Secret referenced by
spec.output.authSecretReforspec.output.tls.caSecretReflives incpaas-system. The webhook rejects aLogForwardthat references Secrets in any other namespace.
LogForward lives in cpaas-system only
The admission webhook validate-lf.log.alauda.io rejects any LogForward created outside cpaas-system. This is a hard constraint from Bug 205 (zero-touch operator ns): the operator only reconciles Vector Deployments and Secrets in its operand namespace, and cross-namespace secret plumbing was deliberately removed. The platform administrator, not the tenant, is expected to author each LogForward.
Spec shape
Every LogForward has four sections:
spec.inputs[]— one or more logical topics the CR consumes. Each input picks atype(log,audit, orevent) that maps to the platform's Kafka topic, and an optionalselectorthat filters bynamespacesorpodLabels.spec.filters[]— optional list of typed transforms (parse,filter,redact,prune,remapFields). Raw VRL is not allowed.spec.pipelines[]— required list that wires each pipeline'sinputRefsand optionalfilterRefsinto the single output.spec.output— exactly one sink.typepicks the sink and the matching type-specific block carries its parameters; the sharedendpoint,authSecretRef, andtlsfields sit at the output's top level.
Common Recipes
Mirror the platform's log and audit streams to a user Kafka
Two inputs, no filters, one pipeline per input, all fanned into the same Kafka mirror sink.
Forward the platform's log stream to a user OpenSearch, with prune and redact
Forward audit records to an HTTP intake
authSecretRef and Authorization header are mutually exclusive
vector's http sink refuses to start with both [sinks.output.auth] and a headers.Authorization entry — the message is Authorization header can not be used with defined auth options. Pick one path:
- Basic auth: set
authSecretRef, leavehttp.headerswithout anAuthorizationentry. - API token / JWT: leave
authSecretRefunset and put the full value inhttp.headers.Authorizationyourself (for exampleBearer <jwt>orSplunk <token>).
The webhook rejects the conflict at admission time. (Bug 210 F-1.)
Ship a namespace's log stream to a syslog collector
The output uses encoding.codec = "json" and writes the entire event as one JSON string per record. The operator does not construct RFC 5424 PRI headers or map fields to syslog facility / severity — the receiving server is expected to parse the JSON body. This matches the v4.3 chart-alauda-log-agent on-wire contract; the pt L / M rewrite that tried to emit RFC 5424 was reverted in beta.322 after two vector 0.55 codec bugs silently dropped every event.
Verify
After you apply a LogForward, log-storage-operator builds a Vector Deployment for it in cpaas-system. Watch the resource until it reports Ready=True:
Read the conditions if it does not go Ready:
The LogForward status is deliberately minimal — observedGeneration, Phase, and readiness conditions. It does not report consumer group, topic, lag, partition, offset, replica detail, output name, endpoint, or Secret name. For runtime data-path issues, read the generated Vector Deployment's pod logs.
Limits and Notes
- One
LogForwardproduces exactly one Vector Deployment. Each replica joins the same Kafka consumer group. - The consumer group name is
logforward-<lf-name>. The platform'sKafkaUsermust include alogforward-group prefix ACL rule; without it, vector silently fails withGroupAuthorizationFailedand the LF reportsReady=Truewhile reading zero records. See Installation Section 1.1.1 step 3 for the required ACL. (Bug 168d v2.) - One
LogForwardhas exactly oneoutput. To fan out to multiple destinations, create oneLogForwardper destination. - Every
filterof typefiltermust set at least one non-empty predicate (equals,notEquals,contains, ormatches) per condition. An all-empty condition compiles tofalseand aborts every event silently — the webhook rejects it at admission. (Bug 173 pt1.) - Uninstalling Alauda Container Platform Log Storage Management stops the operator; any active
LogForwardDeployments are removed as part of the storage operator uninstall. LogForwardis not intended as a replacement for the platform's storage pipeline. Removing the storage operator removes log query on the console;LogForwardalone does not restore that.
Related Topics
- Installation — how to install the storage operator that publishes the
LogForwardCRD, and how to set up thelogforward-KafkaUser prefix ACL rule. - How to Archive Logs to Third-Party Storage — the older
razor consumer --database-type=filearchive workflow, intended for NFS / S3 archival rather than real-time forwarding.