Skip to content

Commit

Permalink
Send tink-worker logs to stdout instead of stderr: (#833)
Browse files Browse the repository at this point in the history
## Description


In HookOS, normally, all Docker logs are sent via syslog to Smee. When a container writes its logs to stderr the Docker syslog driver will set the severity to "ERR". This then shows up in Smee's logs. User are consistently confused as to what this severity means and more often than not, they believe the log line to be an error. By writing tink-worker logs to stdout the severity in syslog will be "INFO".

Examples:

Before:

```bash
{"level":"info","ts":1699046587.4014122,"caller":"syslog/receiver.go:160","msg":"msg","msg":{"app-name":"e89e8c7e84ba","facility":"daemon","host":"10.42.0.15","msg":{"caller":"cmd/root.go:53","level":"info","logger":"github.com/tinkerbell/tink","msg":"starting","ts":1699046585.7805724,"version":"devel"},"procid":"736","severity":"ERR"}}
{"level":"info","ts":1699046587.4016318,"caller":"syslog/receiver.go:160","msg":"msg","msg":{"app-name":"e89e8c7e84ba","facility":"daemon","host":"10.42.0.15","msg":{"caller":"worker/worker.go:249","level":"info","logger":"github.com/tinkerbell/tink","msg":"starting to process workflow actions","ts":1699046585.7809546,"workerID":"52:54:00:0f:2e:67"},"procid":"736","severity":"ERR"}}
```

After:

```bash
{"level":"info","ts":1699047980.6784308,"caller":"syslog/receiver.go:160","msg":"msg","msg":{"app-name":"947f1fb0d32c","facility":"daemon","host":"10.42.0.15","msg":{"caller":"cmd/root.go:55","level":"info","logger":"github.com/tinkerbell/tink","msg":"starting","ts":1699047979.8558161,"version":"devel"},"procid":"738","severity":"INFO"}}
{"level":"info","ts":1699047980.6787195,"caller":"syslog/receiver.go:160","msg":"msg","msg":{"app-name":"947f1fb0d32c","facility":"daemon","host":"10.42.0.15","msg":{"caller":"worker/worker.go:249","level":"info","logger":"github.com/tinkerbell/tink","msg":"starting to process workflow actions","ts":1699047979.8561027,"workerID":"52:54:00:0f:2e:67"},"procid":"738","severity":"INFO"}}
```

## Why is this needed



Fixes: #

## How Has This Been Tested?





## How are existing users impacted? What migration steps/scripts do we need?





## Checklist:

I have:

- [ ] updated the documentation and/or roadmap (if required)
- [ ] added unit or e2e tests
- [ ] provided instructions on how to upgrade
  • Loading branch information
mergify[bot] authored Nov 3, 2023
2 parents a9b0899 + e124c55 commit 7f417ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/tink-worker/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const (

// NewRootCommand creates a new Tink Worker Cobra root command.
func NewRootCommand(version string) *cobra.Command {
zlog, err := zap.NewProduction()
config := zap.NewProductionConfig()
config.OutputPaths = []string{"stdout"}
zlog, err := config.Build()
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 7f417ed

Please sign in to comment.