diff --git a/command/agent/command.go b/command/agent/command.go index 93ddaf5e7d27..cf875d5226b8 100644 --- a/command/agent/command.go +++ b/command/agent/command.go @@ -618,6 +618,15 @@ func (c *Command) Run(args []string) int { return 1 } + // reset UI to prevent prefixed json output + if config.LogJson { + c.Ui = &cli.BasicUi{ + Reader: os.Stdin, + Writer: os.Stdout, + ErrorWriter: os.Stderr, + } + } + // Setup the log outputs logFilter, logGate, logOutput := SetupLoggers(c.Ui, config) c.logFilter = logFilter