kubernetes_logs: since 0.55.0 the on-disk backlog is read at once and held — 129 MB of /var/log/pods peaks at 1.7 GiB (0.54.0: 95 MiB)
Problem
From 0.55.0 on, a kubernetes_logs source started against an existing /var/log/pods is OOM-killed within about a minute of its first file scan. 0.54.0 and earlier stream the same backlog at a flat ~95 MiB.
Measured on a single-node k3d cluster (k3s v1.34.7, containerd) with 49 pods, 81 *.log files and 129 MB under /var/log/pods, Vector as a DaemonSet with a blackhole sink so no sink is involved:
| Version | Pipeline | Memory limit | Result |
|---|---|---|---|
| 0.54.0 | kubernetes_logs → remap → filter → blackhole | 256 MiB | runs, 95–97 MiB flat for an hour |
| 0.55.0 / 0.56.0 / 0.58.0 | same | 1 GiB | OOMKilled 65–77 s after start, right after the first Found new file to watch |
| 0.58.0 | same | 3 GiB | survives; kubectl top reads 25 MiB until the first scan, then 1699 MiB, settling at 1172 MiB and staying there |
| 0.58.0 | same, read_from: end |
1 GiB | survives; 479 MiB at the first scan, settling at 354 MiB |
| 0.58.0 | kubernetes_logs → blackhole, no transforms | 1 GiB | borderline: survives when **/*.gz rotations are excluded, dies when they are not |
So the whole backlog appears to be read into memory in one pass and retained, and the steady state after it is roughly ten times 0.54's. The same 129 MB copied off the node and replayed through the plain file source (0.55.0, read_from: beginning, same remap and filter, 1 GiB) does not reproduce: 90 MiB steady, 174k events. It needs the kubernetes_logs path.
The only source-side changes between v0.54.0 and v0.55.0 are #25064 (lib/file-source/src/file_watcher/mod.rs, lib/file-source-common/src/buffer.rs), which is where I would look first.
Repro
A node with a non-trivial /var/log/pods (ours: 129 MB, kubelet rotation at 10 MB). DaemonSet with timberio/vector:0.58.0-distroless-libc, memory limit 1Gi, /var/log and /var/lib mounted read-only, a service account that can list and watch pods, namespaces and nodes, and this config (it died at 70 s on the last run, every run):
data_dir: /vector-data-dir
sources:
kubernetes:
type: kubernetes_logs
transforms:
enrich:
type: remap
inputs: ["kubernetes"]
source: |
.namespace = .kubernetes.pod_namespace
.pod = .kubernetes.pod_name
.container = .kubernetes.container_name
del(.kubernetes)
parsed, err = parse_json(.message)
if err == null && is_object(parsed) {
. = merge(object!(parsed), .)
}
if !exists(.level) {
m, e = parse_regex(string!(.message), r'(?i)\b(?P<l>trace|debug|info|warn|error|fatal)\b')
if e == null { .level = downcase(string!(m.l)) }
}
keep:
type: filter
inputs: ["enrich"]
condition:
type: vrl
source: '!contains(string(.message) ?? "", "kube-probe")'
sinks:
sink:
type: blackhole
inputs: ["keep"]
print_interval_secs: 30Watch kubectl get pod -w: OOMKilled about 60–75 s after start. Swap the image for 0.54.0-distroless-libc: the same config runs at under 100 MiB.
Environment
- Vector 0.55.0, 0.56.0, 0.58.0 (
timberio/vector:*-distroless-libc); 0.54.0 is the last good release, 0.50.0 also fine. - k3s v1.34.7+k3s1 in k3d on Docker Desktop (WSL2), containerd, one node.
Source: vectordotdev/vector