Skip to content

Make the log level of Go services configurable - #2413

Merged
vihangm merged 1 commit into
pixie-io:mainfrom
NopeCharon:add-service-log-level-flag
Oct 26, 2026
Merged

vihangm merged 1 commit into
pixie-io:mainfrom
NopeCharon:add-service-log-level-flag

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

Summary: Make the log level of Go services configurable

Every Go service in Pixie Cloud and Vizier calls services.SetupServiceLogging(), which hard coded the logrus level to info. As discussed in the issue, there was no way to reduce log volume or turn on debug logging without rebuilding.

Following the approach suggested in the issue, this PR adds a common --log_level flag to service_flags.go and uses it in SetupServiceLogging(). Like the other service flags, it can also be set with the PL_LOG_LEVEL environment variable. It accepts any logrus level (panic, fatal, error, warn, info, debug, trace, case insensitive) and defaults to info, so current deployments behave exactly as before. An invalid value is a fatal configuration error, the same way CheckServiceFlags() handles other invalid flags.

The level is applied after flags are parsed, so the Starting service line that SetupService() logs before parsing is still printed at info level.

This only affects the Go logrus logger. The C++ (glog) logging in PEM, Kelvin and the query broker already has its own runtime flags.

Relevant Issues: Fixes #2280

Type of change: /kind feature

Test Plan: Added //src/shared/services:services_test, which checks the default level, explicit levels, case insensitivity, and that an invalid level is fatal. The explicit level cases fail on main. I also built scriptmgr and ran it locally. With no flag it logs at info. With --log_level=error, only error logs are printed after startup. With PL_LOG_LEVEL=debug, debug logs are printed. With --log_level=bogus, it exits with Flag --log_level or ENV PL_LOG_LEVEL is invalid. go vet and golangci-lint v2.3.1 with the repo's .golangci.yaml are clean.

Changelog Message:

Go services in Pixie Cloud and Vizier now accept a `--log_level` flag (or `PL_LOG_LEVEL` environment variable) to configure their log level. The default remains `info`.

All Go services call services.SetupServiceLogging(), which hard coded the
logrus level to info. Operators who want to reduce log volume (or debug a
service) had no way to change it without rebuilding.

Add a common --log_level flag, which can also be set through the
PL_LOG_LEVEL environment variable like every other service flag, and use
it in SetupServiceLogging(). It accepts any logrus level name (panic,
fatal, error, warn, info, debug, trace) and defaults to info, so existing
deployments keep their current behavior. An invalid value is a fatal
configuration error, in line with how CheckServiceFlags() handles other
invalid flags.

Fixes pixie-io#2280

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
@NopeCharon
NopeCharon requested a review from a team as a code owner October 26, 2026 12:21
@NopeCharon
NopeCharon deployed to pr-actions-approval October 26, 2026 12:21 — with GitHub Actions Active
@vihangm

vihangm commented Oct 26, 2026

Copy link
Copy Markdown
Member

ASAN test seems to be flaky on main. Merging.

@vihangm
vihangm merged commit 50cabe7 into pixie-io:main Oct 26, 2026
34 of 38 checks passed

This branch was successfully deployed

1 active deployment
pr-actions-approval — f34e4c47 Deployed Oct 26, 2026 by NopeCharon via authorize #3144
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Allow Runtime Configuration of Pixie Logging Level (Env Vars or CLI Flags)

2 participants