Watch
0
0
Fork
You've already forked hyperhive
0

swarm-otel ships its own journal, so its logs reach the store

The collector's container ran with --link-journal=host and the host's
journal bound over /var/log/journal, so its own journal was never
written where anything read it. It now keeps its journal in the guest,
reads it with a second journald receiver, and gets the host's journal
at /run/host-journal.

On deploy swarm-otel rows start arriving in the store, stamped
service.name swarm-otel.
This commit is contained in:
atlas 2026-10-19 20:25:23 +02:00
commit 8476609f98
3 changed files with 83 additions and 24 deletions

View file

@ -259,6 +259,32 @@ let
# The window has to outlast every attempt, or the burst is unreachable.
&& u.startLimitIntervalSec or 0 > u.serviceConfig.RestartSec * u.startLimitBurst;
}
{
# 🩸 The container's own journal reaches the stores from the collector
# itself. Mounting the host's journal over the guest's /var/log/journal
# (or `--link-journal=host`) leaves `journald/self` reading nothing while
# the collector looks healthy. Presence controls: the host receiver and
# its mount are asserted too, so a misspelt path cannot pass.
name = "the swarm collector ships its own journal, and the host's from a mount that leaves it alone";
ok =
let
c = otelNoStores.containers.swarm-otel;
s = otelSettings otelNoStores;
self = lib.filter (p: builtins.elem "journald/self" p.receivers) (
lib.attrValues s.service.pipelines
);
in
!(lib.elem "--link-journal=host" (c.extraFlags or [ ]))
&& s.receivers."journald/self".directory == "/var/log/journal"
&& s.receivers."journald/self".merge
&& s.receivers.journald.directory == "/run/host-journal"
&& c.bindMounts."/run/host-journal".hostPath == "/var/log/journal"
&& !(c.bindMounts ? "/var/log/journal")
&& lib.length self == 1
&& lib.all (p: p.exporters == [ "otlphttp/victorialogs" ]) self
&& lib.elem "resource/self-journal" (lib.head self).processors
&& builtins.elem "resource/self-journal" (lib.attrNames s.processors);
}
];
in
runGroup "swarm-otel-core" cases