Skip to main content
Version: main 🚧

Collect pod logs

The cluster-collector template, described in Configure edge collectors, can also ship pod logs through the Write Gateway. Log collection is off by default. When you set collectLogs to "true", the otel-daemon collector tails the log file of every pod on each node it runs on. It sends the records to the gateway with the same metrics-writer token it uses for metrics.

The gateway stamps each log record with the same vcluster_platform_* resource attributes it stamps on metrics, taken from the writer key's verified scope. The collector can't set or override these attributes. See the labels reference.

Use log collection only on clusters with private nodes

On shared nodes, vCluster redirects the collector's host log mount to a directory for the cluster. Without the HostPath Mapper, that directory stays empty. The collector finds no pod logs and sends nothing, and it keeps running, so nothing signals the gap. Platform doesn't block the setting, so only set collectLogs for clusters that run on their own private nodes.

Turn on log collection​

Log collection runs the otel-daemon collector as group 0 so it can read the node's pod log files. If a policy on the cluster blocks group 0, otel-daemon doesn't start, and its nodes stop sending metrics as well as logs. otel-daemon skips its own logs but collects the logs of the otel-deploy collector.

  1. Add a destination with signal: logs to the observability connector. The gateway only builds a logs pipeline when the connector has at least one logs destination. Without one, the gateway rejects incoming logs. The collectors record export errors and discard the records. See Forward telemetry to additional destinations.

  2. Set collectLogs in the application's parameters:

    fleet-edge-collectors.yaml
    spec:
    parameters:
    destinationNamespace: observability
    collectLogs: "true"
  3. Query your logs backend for records whose vcluster_platform_instance attribute names this cluster. Logs written before you turned on log collection never arrive, and lines written while an otel-daemon pod restarts are lost. On a quiet cluster, this query can return nothing even though collection works. If none arrive, see Pod logs don't arrive.