telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

Output to stdout by default

Open aep-sunlife opened this issue 9 months ago • 2 comments

Use Case

Modern applications use an approach called zero configuration, in which the default configuration file is 100% valid.

Today, telegraf takes a more classical approach, requiring the user to customize configuration. Otherwise the application crashes. That's an awful out of the box experience.

Instead of bombing out with generic parse error messages on the stock configuration file, telegraf should automatically set outputs.file to ["stdout"].

By the way, the default configuration file has many gaps in terms of failing to mention the default configuration, for about half of the assorted fields. Many of the fields fail to nest comments, further complicating the default behavior.

The documentation occasionally hints at a need to customize outputs, but that's still a far cry from zeroconf.

Expected behavior

Output to stdout by default, so that the telegraf config default configuration file finally becomes 100% valid.

Actual behavior

$ telegraf config >telegraf.config
$ telegraf -config telegraf.conf
2025-04-02T16:58:47Z I! Loading config: telegraf.conf
2025-04-02T16:58:47Z E! [telegraf] Error running agent: no outputs found, probably invalid config file provided

Additional info

No response

aep-sunlife avatar Apr 02 '25 16:04 aep-sunlife

The failure to implement zeroconf also breaks the Homebrew formula service and foreground process out of the box.

mcandre avatar Apr 02 '25 17:04 mcandre

I would really like to see a PR that injects a

[[outputs.file]]
  files = ["stdout"]

to the example config.

srebhan avatar Apr 03 '25 15:04 srebhan