Skip to content

Provisionerd: log provisioner output to provisionerd log #1733

Closed

Description

@johnstcn

What is your suggestion?

Currently we only log provisioner job output at debug level, regardless of the log level of the provisioner job log -- meaning that most users won't see it by default in the coderd output.

Instead, log the content of sdkproto.Provision_Response_Log.Log.Output to a separate logger.
This should be a separate logger to the main coderd log, and should have independent verbosity configurable via CLI flag and env var.

Part of this change could involve some handy interface between sdkproto.LogLevel and slog.Logger e.g.

type levelLogger struct {
	slog.Logger
}

func (l *levelLogger) LogWithLevel(ctx context.Context, level sdkproto.LogLevel, msg string, fields ...slog.Field) {
	switch level {
	case sdkproto.LogLevel_DEBUG:
		l.Debug(ctx, msg, fields...)
	case sdkproto.LogLevel_TRACE:
		l.Debug(ctx, msg, fields...)
	case sdkproto.LogLevel_ERROR:
		l.Error(ctx, msg, fields...)
	case sdkproto.LogLevel_WARN:
		l.Warn(ctx, msg, fields...)
	default:
		l.Info(ctx, msg, fields...)
	}
}

Why do you want this feature?

In larger environments, Coder administrators may need to debug build / provision errors on behalf of users.
In these cases, it would be useful to have the logs available to administartors.

Are there any workarounds to get this functionality today?

Users would have to copy-paste the provisioner output to the Coder adminstrator, who would then need to correlate that with the coderd/provisionerd logs. This requires extra coordination and effort on behalf of both admin and user.

Are you interested in submitting a PR for this?

Yes

Activity

  1. changed the title [-]Feat: provisionerd: log provisioner output to provisionerd log[/-] [+]Provisionerd: log provisioner output to provisionerd log[/+] on Jun 7, 2022
  2. github-actions commented on Aug 7, 2022

    @github-actions
    Contributor

    This issue is becoming stale. In order to keep the tracker readable and actionable, I'm going close to this issue in 7 days if there isn't more activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiArea: HTTP APIstaleThis issue is like stale bread.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions