From a047dbac06e2142df43099f07248f246b6be4d4c Mon Sep 17 00:00:00 2001 From: Noah Stride Date: Tue, 19 Aug 2025 13:51:28 +0100 Subject: [PATCH 1/2] Add initial log message with version to tbot --- lib/tbot/tbot.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/tbot/tbot.go b/lib/tbot/tbot.go index 35aeb6ab09220..6845b4316f089 100644 --- a/lib/tbot/tbot.go +++ b/lib/tbot/tbot.go @@ -21,7 +21,9 @@ package tbot import ( "context" "errors" + "fmt" "log/slog" + "runtime" "sync" "github.com/gravitational/trace" @@ -118,6 +120,10 @@ func (b *Bot) getClient() *apiclient.Client { func (b *Bot) Run(ctx context.Context) (err error) { ctx, span := tracer.Start(ctx, "Bot/Run") defer func() { apitracing.EndSpan(span, err) }() + b.log.InfoContext( + ctx, "Initializing tbot", + "version", versionString(), + ) if err := metrics.RegisterPrometheusCollectors( metrics.BuildCollector(), @@ -364,3 +370,12 @@ func checkDestinations(ctx context.Context, cfg *config.BotConfig) error { return nil } + +func versionString() string { + return fmt.Sprintf( + "v%s git:%s %s\n", + teleport.Version, + teleport.Gitref, + runtime.Version(), + ) +} From b3dd738046d98c860548dc7fc96f94a7e4d94607 Mon Sep 17 00:00:00 2001 From: Noah Stride Date: Tue, 19 Aug 2025 14:08:24 +0100 Subject: [PATCH 2/2] Embrace structured logging --- lib/tbot/tbot.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/tbot/tbot.go b/lib/tbot/tbot.go index 6845b4316f089..6ac401315e234 100644 --- a/lib/tbot/tbot.go +++ b/lib/tbot/tbot.go @@ -21,7 +21,6 @@ package tbot import ( "context" "errors" - "fmt" "log/slog" "runtime" "sync" @@ -122,7 +121,7 @@ func (b *Bot) Run(ctx context.Context) (err error) { defer func() { apitracing.EndSpan(span, err) }() b.log.InfoContext( ctx, "Initializing tbot", - "version", versionString(), + "version", versionLogValue(), ) if err := metrics.RegisterPrometheusCollectors( @@ -371,11 +370,10 @@ func checkDestinations(ctx context.Context, cfg *config.BotConfig) error { return nil } -func versionString() string { - return fmt.Sprintf( - "v%s git:%s %s\n", - teleport.Version, - teleport.Gitref, - runtime.Version(), +func versionLogValue() slog.Value { + return slog.GroupValue( + slog.String("teleport", teleport.Version), + slog.String("teleport_git", teleport.Gitref), + slog.String("go", runtime.Version()), ) }