Skip to content

Commit

Permalink
chore: Log pod & node names (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarolisL authored Oct 14, 2024
1 parent d27efc1 commit e5eb578
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/agent/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ func run(ctx context.Context) error {
remoteLogger.SetLevel(logrus.Level(cfg.Log.Level))
remoteLogger.SetFormatter(&textFormatter)
log := remoteLogger.WithField("version", ctx.Value("agentVersion").(*config.AgentVersion).Version)
if podName := os.Getenv("SELF_POD_NAME"); podName != "" {
log = log.WithField("component_pod_name", podName)
}

if nodeName := os.Getenv("SELF_POD_NODE"); nodeName != "" {
log = log.WithField("component_node_name", nodeName)
}

localLog := logrus.New()
localLog.SetLevel(logrus.DebugLevel)
Expand Down

0 comments on commit e5eb578

Please sign in to comment.