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

Silence AWS plugin logs #254

Closed
williamhpark opened this issue Apr 28, 2023 · 0 comments · Fixed by #297
Closed

Silence AWS plugin logs #254

williamhpark opened this issue Apr 28, 2023 · 0 comments · Fixed by #297
Assignees

Comments

@williamhpark
Copy link
Contributor

williamhpark commented Apr 28, 2023

Platform or tool

AWS

Desired or expected behavior

  1. Initialize the AWS plugin: op plugin init aws
  2. Run an aws command using the plugin, e.g. aws s3 ls

The command should run successfully with no unnecessary log output.

Current behavior

A few unnecessary lines of log output are outputted (shown in Relevant log output).

The source of these logs is /plugins/aws/sts_provisioner.go -> getAWSAuthConfigurationForProfile:

configFile, err := confighelpers.LoadConfigFromEnv()

A solution could be to silence the log output with log.SetOutput(io.Discard) then re-enable it, similar to in this PR:

// Disable log output produced by AWS Vault code
log.SetOutput(io.Discard)

// Read config file from the location set in AWS_CONFIG_FILE env var or from  ~/.aws/config
configFile, err := confighelpers.LoadConfigFromEnv()
if err != nil {
return nil, err
}

// Re-enable log output
log.SetOutput(os.Stdout)

Relevant log output

2023/04/28 10:40:34 Loading config file /Users/williampark/.aws/config
2023/04/28 10:40:34 Parsing config file /Users/williampark/.aws/config

op CLI version

No response

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 a pull request may close this issue.

2 participants