Watch
0
0
Fork
You've already forked hyperhive
0

add the egress log dashboard

This commit is contained in:
atlas 2026-10-30 02:22:02 +01:00
commit 700279026f

View file

@ -452,6 +452,27 @@ let
]
&& lib.all (m: lib.hasInfix "\"${m}\"" recorded) queried;
}
{
# The egress board ships, and the `extract` pattern its queries use is the
# field layout of the `would_deny` line squid logs: a changed `logformat`
# is a board of empty panels.
name = "the egress dashboard ships, and reads the field layout of squid's would_deny log line";
ok =
let
provider = lib.head grafanaWithAuthelia.containers.swarm-grafana.config.services.grafana.provision.dashboards.settings.providers;
shipped = lib.attrNames provider.options.path.entries;
board = builtins.fromJSON (builtins.readFile ../host-modules/swarm-grafana/dashboards/egress.json);
exprs = lib.concatMap (p: map (t: t.expr or "") (p.targets or [ ])) board.panels;
pattern = "would_deny user=<agent> method=<method> host=<dest> port=<port> result=<result>";
agentVar = lib.findFirst (v: v.name == "agent") null board.templating.list;
squid = builtins.readFile ../host-modules/hive-squid.nix;
in
lib.elem "egress.json" shipped
&& lib.length (lib.filter (e: lib.hasInfix pattern e) exprs) == 5
&& agentVar != null
&& lib.hasInfix pattern agentVar.query.query
&& lib.hasInfix "logformat would_deny would_deny user=%[un method=%rm host=%>rd port=%>rP result=" squid;
}
{
# The standing check on the collector's PRIORITY mapping — whether a line
# ever reaches the log store carrying no severity. It is shipped config