Add .log suffix to dumped pod logs

This commit is contained in:
Peter Rifel 2021-09-05 11:31:04 -05:00
parent 43906b993d
commit a467aa17a5
No known key found for this signature in database
GPG Key ID: BC6469E5B16DB2B6
1 changed files with 2 additions and 2 deletions

View File

@ -278,8 +278,8 @@ func (n *logDumperNode) dump(ctx context.Context) []error {
for _, selector := range n.dumper.podSelectors {
kv := strings.Split(selector, "=")
app := kv[len(kv)-1]
if err := n.shellToFile(ctx, "if command -v kubectl &> /dev/null; then kubectl logs -n kube-system --all-containers -l \""+selector+"\"; fi", filepath.Join(n.dir, app)); err != nil {
logFile := fmt.Sprintf("%v.log", kv[len(kv)-1])
if err := n.shellToFile(ctx, "if command -v kubectl &> /dev/null; then kubectl logs -n kube-system --all-containers -l \""+selector+"\"; fi", filepath.Join(n.dir, logFile)); err != nil {
errors = append(errors, err)
}
}