Skip to content

Commit

Permalink
Merge #53466
Browse files Browse the repository at this point in the history
53466: roachtest: fetch redacted logs r=knz a=tbg

To polish redacted logs, change roachtest to collect redacted logs by
default. The unredacted logs (along with heap profiles, etc) are
retained in the artifacts as well to make sure we're not adding
debugging friction during the stability period.

All engineers are encouraged to default to using the redacted logs
(which are combined, and thus likely more ergonomical to use on
average) and to send PRs for any issues they observe.

The resulting file structure here is as follows:

```
$ ls artifacts/acceptance/multitenant/run_1/logs/
1.cockroach.log  1.unredacted/    2.cockroach.log  2.unredacted/    [...]
```

Release justification: testing-only change
Release note: None

Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
  • Loading branch information
craig[bot] and tbg committed Aug 26, 2020
2 parents f0361d7 + 7402763 commit c046a2b
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions pkg/cmd/roachtest/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1488,12 +1488,28 @@ func (c *cluster) FetchLogs(ctx context.Context) error {

// Don't hang forever if we can't fetch the logs.
return contextutil.RunWithTimeout(ctx, "fetch logs", 2*time.Minute, func(ctx context.Context) error {
path := filepath.Join(c.t.ArtifactsDir(), "logs")
path := filepath.Join(c.t.ArtifactsDir(), "logs", "unredacted")
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
return err
}

return execCmd(ctx, c.l, roachprod, "get", c.name, "logs" /* src */, path /* dest */)
if err := execCmd(ctx, c.l, roachprod, "get", c.name, "logs" /* src */, path /* dest */); err != nil {
log.Infof(ctx, "failed to fetch logs: %v", err)
if ctx.Err() != nil {
return err
}
}

if err := c.RunE(ctx, c.All(), "mkdir -p logs/redacted && ./cockroach debug merge-logs --redact logs/*.log > logs/redacted/combined.log"); err != nil {
log.Infof(ctx, "failed to redact logs: %v", err)
if ctx.Err() != nil {
return err
}
}

return execCmd(
ctx, c.l, roachprod, "get", c.name, "logs/redacted/combined.log" /* src */, filepath.Join(c.t.ArtifactsDir(), "logs/cockroach.log"),
)
})
}

Expand Down

0 comments on commit c046a2b

Please sign in to comment.