diff --git a/changelog/16714.txt b/changelog/16714.txt new file mode 100644 index 000000000..a13610699 --- /dev/null +++ b/changelog/16714.txt @@ -0,0 +1,3 @@ +```release-note:bug +debug: Remove extra empty lines from vault.log when debug command is run +``` \ No newline at end of file diff --git a/command/debug.go b/command/debug.go index 631ec9b41..8213507cd 100644 --- a/command/debug.go +++ b/command/debug.go @@ -1080,13 +1080,15 @@ func (c *DebugCommand) writeLogs(ctx context.Context) { for { select { case log := <-logCh: - if !strings.HasSuffix(log, "\n") { - log += "\n" - } - _, err = out.WriteString(log) - if err != nil { - c.captureError("log", err) - return + if len(log) > 0 { + if !strings.HasSuffix(log, "\n") { + log += "\n" + } + _, err = out.WriteString(log) + if err != nil { + c.captureError("log", err) + return + } } case <-ctx.Done(): return diff --git a/website/content/api-docs/system/monitor.mdx b/website/content/api-docs/system/monitor.mdx index e29f2cb46..377c22cac 100644 --- a/website/content/api-docs/system/monitor.mdx +++ b/website/content/api-docs/system/monitor.mdx @@ -26,7 +26,7 @@ default, this is text. - `log_level` `(string: "info")` – Specifies the log level to use when streaming logs. This defaults to `info` if not specified. -- `log_format` `(string: "standard")` – Specifies the log format to emit when streaming logs. Supported values are "standard" and "json". The default is `standard`. +- `log_format` `(string: "standard")` – Specifies the log format to emit when streaming logs. Supported values are "standard" and "json". The default is `standard`, if not specified. ### Sample Request