telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

default config file 14K lines long

Open mcandre opened this issue 9 months ago • 6 comments

Relevant telegraf.conf

Too long to paste

Logs from Telegraf

N/A

System info

Telegraf 1.34.1

Docker

No response

Steps to reproduce

  1. telegraf config

Expected behavior

telegraf config generates a minimal zeroconf file, and the assorted distributions (Docker image, Homebrew formula, macOS DMG, Linux packages, Windows packages, etc.) present a similarly concise default configuration file.

Actual behavior

The default config is about 14,000 lines long. This is too much irrelevant information for most users. It takes up more space on disk than necessary. Such details should be housed elsewhere, such as online configuration documentation.

Additional info

No response

mcandre avatar Apr 02 '25 17:04 mcandre

@mcandre nobody forces you to use the entire example configuration! Some users do not prefer to search online documentation but prefer to have minimal information in the configuration file itself. You can easily create a tailored configuration using the plugin-filter command-line options or by copying the sample.conf files of the plugins you want (plus an agent config).

I'm not sure what you are suggesting here. We do have more than 300 plugins and each of those may have multiple options. A config containing all of those will never be "short", so what is your suggestion?

srebhan avatar Apr 03 '25 15:04 srebhan

For a system this complex, the default configuration file may not be the most appropriate place to present this information. In fact, the existing documentation here is quite poor. Comment nesting is inconsistent. Default values unclear. So consulting other documentation is necessary. Even running the application to observe the behavior is necessary. What a mess.

mcandre avatar Apr 03 '25 17:04 mcandre

@mcandre I do agree with your complaints about documentation. I wish everyone complaining about documentation would send one PR to improve it... ;-)

For the configuration file, I'm happy to take a PR that can create a minimum configuration file, whatever this means without knowing the output or which information you want as input. You then can just override the default config with this! Nobody forces you to use or deploy the default config.

srebhan avatar Apr 14 '25 08:04 srebhan

If the current default configuration file were readable then it would be trivial to create a minimal file: touch telegraf.conf. The fact that the default values are not documented clearly precludes this possibility, without opening the source code and exhaustively examining the configuration loading code. Doubt they use 100% Go zero values.

mcandre avatar Apr 14 '25 14:04 mcandre

@mcandre the default value is shown in the commented options. If a setting is mandatory, it is not commented! That's the convention. If a plugin does not follow this convention it's a bug, so if you find one, you should open an issue!

You can generate a starting point by e.g. running

# telegraf config create --section-filter "inputs:outputs" --input-filter "cpu:mem" --output-filter "influxdb_v2"  

to create a config with only inputs.cpu, inputs.mem and outputs.influxdb_v2! Having an empty config file will not work as we cannot know which plugins you want!

srebhan avatar May 09 '25 10:05 srebhan

Would like every section save the InfluxDB output plugin removed from the stock config, for brevity. Other options can be described in documentation.

On Fri, May 9, 2025 at 5:28 AM, Sven Rebhan @.***(mailto:On Fri, May 9, 2025 at 5:28 AM, Sven Rebhan < wrote:

srebhan left a comment (influxdata/telegraf#16719)

@.***(https://github.com/mcandre) the default value is shown in the commented options. If a setting is mandatory, it is not commented! That's the convention. If a plugin does not follow this convention it's a bug, so if you find one, you should open an issue!

You can generate a starting point by e.g. running

telegraf config create --section-filter "inputs:outputs" --input-filter "cpu:mem" --output-filter "influxdb_v2"

to create a config with only inputs.cpu, inputs.mem and outputs.influxdb_v2! Having an empty config file will not work as we cannot know which plugins you want!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mcandre avatar May 09 '25 14:05 mcandre

@mcandre I'm not sure I do understand your issue and I'm not sure you did read my previous message. When running

# telegraf config create --section-filter "agent:outputs" --output-filter "influxdb_v2"          

you get a config with only the outputs.influxdb_v2 plugin and the agent settings. Stripping the comments this looks like

[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = "0s"

[[outputs.influxdb_v2]]
  urls = ["http://127.0.0.1:8086"]
  token = ""
  organization = ""
  bucket = ""

which you can redirect to a file and get your config. So the possibility to strip down the config already exists! Alternatively, you can download the sample.conf files of your plugin from Github or copy-paste it from the README.

We have the excessive config to allow users to discover plugins (just hit Ctrl-F in your favorite editor) without the need to navigate to documentation and we will keep it like this. As I said the ability to trim the config to what you want already exists (see above) therefore closing this issue as "won't fix".

srebhan avatar Jul 04 '25 09:07 srebhan