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 debug logging less chatty #26291

Closed
nfx opened this issue Sep 18, 2020 · 2 comments
Closed

Make debug logging less chatty #26291

nfx opened this issue Sep 18, 2020 · 2 comments

Comments

@nfx
Copy link

nfx commented Sep 18, 2020

Currently, terraform debug output is a bit chatty and harder to look at for less advanced users to troubleshoot API call sequences because of full name of provider executable is prepended to each line of output:

2020/09/17 10:27:54 [TRACE] GRPCProvider: GetSchema
2020/09/17 10:27:54 [TRACE] GRPCProvider: Configure
2020/09/17 10:27:54 [TRACE] eval: terraform.EvalNoop
2020/09/17 10:27:54 [TRACE] GRPCProvider: Configure
2020-09-17T10:27:54.841-0400 [DEBUG] plugin.terraform-provider-aws_v3.6.0_x5: 2020/09/17 10:27:54 [INFO] AWS Auth provider used: "EnvProvider"
2020-09-17T10:27:54.841-0400 [DEBUG] plugin.terraform-provider-aws_v3.6.0_x5: 2020/09/17 10:27:54 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020-09-17T10:27:54.842-0400 [DEBUG] plugin.terraform-provider-aws_v3.6.0_x5: 2020/09/17 10:27:54 [DEBUG] [aws-sdk-go] DEBUG: Request sts/GetCallerIdentity Details:
2020-09-17T10:27:54.842-0400 [DEBUG] plugin.terraform-provider-aws_v3.6.0_x5: POST / HTTP/1.1
2020-09-17T10:27:54.842-0400 [DEBUG] plugin.terraform-provider-aws_v3.6.0_x5: Host: sts.amazonaws.com
2020-09-17T10:27:54.842-0400 [DEBUG] plugin.terraform-provider-aws_v3.6.0_x5: User-Agent: aws-sdk-go/1.34.14 (go1.14.5; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.13.0 (+https://www.terraform.io)
2020-09-17T10:27:54.842-0400 [DEBUG] plugin.terraform-provider-aws_v3.6.0_x5: Content-Length: 43

Proposal

  1. make datestamp consistent with other log lines
  2. Remove plugin.terraform-provider- & provider version from prefix (or remove it completely... or add a flag to optionally keep it)
  3. Remove double-timestamping lines 2020-09-17T10:27:54.841-0400 [DEBUG] plugin.terraform-provider-aws_v3.6.0_x5: 2020/09/17 10:27:54 [DEBUG] Trying to get account information via sts:GetCallerIdentity by perhaps adjusting SDK

Alternatively, there could be an option just to forward logs at specified level from providers directly.

2020/09/17 10:27:54 [TRACE] GRPCProvider: Configure
2020/09/17 10:27:54 [TRACE] eval: terraform.EvalNoop
2020/09/17 10:27:54 [TRACE] GRPCProvider: Configure
2020/09/17 10:27:54 [DEBUG] [aws]: 2020/09/17 10:27:54 [INFO] AWS Auth provider used: "EnvProvider"
2020/09/17 10:27:54 [DEBUG] [aws]: 2020/09/17 10:27:54 [DEBUG] Trying to get account information via sts:GetCallerIdentity
2020/09/17 10:27:54 [DEBUG] [aws]: POST / HTTP/1.1
2020/09/17 10:27:54 [DEBUG] [aws]: Host: sts.amazonaws.com
2020/09/17 10:27:54 [DEBUG] [aws]: User-Agent: aws-sdk-go/1.34.14 (go1.14.5; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.13.0 (+https://www.terraform.io)
2020/09/17 10:27:54 [DEBUG] [aws]: Content-Length: 43
@nfx nfx added enhancement new new issue not yet triaged labels Sep 18, 2020
@jbardin jbardin added cli and removed new new issue not yet triaged labels Sep 22, 2020
@jbardin
Copy link
Member

jbardin commented Nov 5, 2020

Terraform is not using structured logging throughout via #26632, #26665, #26685 and #26694.
Terraform cannot control what the providers chose to log, but separate loggers should help when a user is only interested in on of the log streams. Updates to the go-plugin and provider sdk packages can help providers better control their output.

Thanks!

@jbardin jbardin closed this as completed Nov 5, 2020
@ghost
Copy link

ghost commented Dec 6, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants