m/n/core: pipe kernel logs into logtree
Currently the kernel log is only available on the local console
(serial/screen) and only if they are high-severity entries.
This log should be inspectable and collectable together with the
other Metropolis logs, thus pipe it into logtree under the root.kernel
node..
Change-Id: If5006db251eb8662ae9939a56e23bbb895304690
Reviewed-on: https://review.monogon.dev/c/monogon/+/2045
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/node/core/main.go b/metropolis/node/core/main.go
index cd9bec0..3eb9024 100644
--- a/metropolis/node/core/main.go
+++ b/metropolis/node/core/main.go
@@ -185,6 +185,14 @@
return fmt.Errorf("when starting pstore: %w", err)
}
+ // The kernel does of course not run in this runnable, only the log pipe
+ // runs in it.
+ if err := supervisor.Run(ctx, "kernel", func(ctx context.Context) error {
+ return logtree.KmsgPipe(ctx, supervisor.Logger(ctx))
+ }); err != nil {
+ return fmt.Errorf("when starting kernel log pipe: %w", err)
+ }
+
// Start the role service. The role service connects to the curator and runs
// all node-specific role code (eg. Kubernetes services).
// supervisor.Logger(ctx).Infof("Starting role service...")
@@ -282,6 +290,11 @@
if strings.HasPrefix(s, "root.role.kubernetes.run.kubernetes.scheduler") {
return p.Leveled.Severity().AtLeast(logtree.WARNING)
}
+ if strings.HasPrefix(s, "root.kernel") {
+ // Linux writes high-severity logs directly to the console anyways and
+ // its low-severity logs are too verbose.
+ return false
+ }
if strings.HasPrefix(s, "supervisor") {
return p.Leveled.Severity().AtLeast(logtree.WARNING)
}