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

Make stdout logging the default and remove syslog from CI #7443

Closed
wants to merge 8 commits into from

Conversation

aarongable
Copy link
Contributor

@aarongable aarongable commented Apr 19, 2024

Make a few changes to remove all by-default dependence on syslog:

  • When constructing a default logger with no configuration (because log.Get() has been called before any logger has been configured), create one that logs only to stdout.
  • For a few one-shot tools that do not take a standard cmd.SyslogConfig configuration struct, suppress syslog output.
  • Update cert-checker to properly construct a logger from its config, rather than ignoring its config and always logging to syslog.

Then, uninstall rsyslog from the integration test docker container since it is no longer necessary. This clears the way to update our docker base image to a newer version which makes it harder to start the rsyslog daemon.

DO NOT MERGE before #7442

@aarongable aarongable requested a review from a team as a code owner April 19, 2024 17:00
@aarongable aarongable requested review from beautifulentropy and removed request for a team April 19, 2024 17:00
Copy link
Contributor

@aarongable, this PR appears to contain configuration and/or SQL schema changes. Please ensure that a corresponding deployment ticket has been filed with the new values.

mcpherrinm
mcpherrinm previously approved these changes Apr 19, 2024
Base automatically changed from rm-caa-log-checker to main April 22, 2024 17:35
@aarongable aarongable dismissed mcpherrinm’s stale review April 22, 2024 17:35

The base branch was changed.

Comment on lines 98 to +104
if _Singleton.log != nil {
err = errors.New("You may not call Set after it has already been implicitly or explicitly set")
// Even though the use of once.Do below prevents a later call from
// overriding an already-set logger, we still do this check so that we can
// return a useful error message.
err := errors.New("You may not call Set after it has already been implicitly or explicitly set")
_Singleton.log.Warning(err.Error())
} else {
_Singleton.log = logger
return err
Copy link
Member

Choose a reason for hiding this comment

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

I understand that this part of the code pre-dates your changes, but I wanted to point out that the check if _Singleton.log != nil outside _Singleton.once.Do() make this unnecessarily racy. However, including it inside Do() would render it redundant because sync.Once guarantees that the initialization code block executes only once. So, perhaps we should consider removing this check altogether.

func Set(logger Logger) (err error) {
// Set configures the singleton Logger. This method must only be called once,
// and before calling Get the first time.
func Set(logger Logger) error {
Copy link
Member

Choose a reason for hiding this comment

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

With so much of the functionality of this package being simplified I can't shake the feeling that both Set() and Get() being exported feels unnecessary. Ideally we should have just a couple of constructors that correctly initialize and return the logger we want. Perhaps there's something I'm missing?

@aarongable
Copy link
Contributor Author

Given that we no longer need these changes to support running pkilint in CI, I'm going to close this PR. We can tackle this again in the mid-term future, on a timetable driven by SRE instead of vice-versa.

@aarongable aarongable closed this Apr 23, 2024
@aarongable aarongable deleted the rm-ci-syslog branch April 23, 2024 21:40
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.

None yet

3 participants