Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tetra: Added dynamic log level change option #2643

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PhilipSchmid
Copy link
Contributor

Added a tetra loglevel subcommand which allows one to dynamically change Tetragon's log level without restarting it.

Supported subcommands:

  get         Prints the current log level
  reset       Reset the log level to the value Tetragon was started with
  set         Set the log level

Fixes: #2545

tetra: Added dynamic log level change option

Added a tetra loglevel subcommand which allows one to dynamically
change Tetragon's log level without restarting it.

Signed-off-by: Philip Schmid <[email protected]>
Copy link

netlify bot commented Jul 5, 2024

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 14427cc
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/66880ce782deb60009c3a8f5
😎 Deploy Preview https://deploy-preview-2643--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

}

// Temporarily set the logger to the lowest level to ensure the message is logged
logger.SetLogLevel(logrus.TraceLevel)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this impact other routines also using logger here? I'm not sure about internals of logging but we wouldn't want to shortly spew debug/trace info if another sensor is running.

Why not just make it a Warn if its critical to have printed? Seems cleaner than bouncing loglevel around.

}

func (s *Server) ResetLogLevel(ctx context.Context, req *tetragon.ResetLogLevelRequest) (*tetragon.ResetLogLevelResponse, error) {
// TODO: Get the original log level with which Tetragon was originally started with in a nicer way than via "option.Config.LogOpts["level"]".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would either drop the todo and create a first issue or do this ;)

@jrfastab
Copy link
Contributor

Like the idea started reviewing before I noticed it was draft. But would be a good addition thanks for working on it.

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.

Dynamic log level change doesn't work the same for all environments
2 participants