Telegraf.d and file ordering

Looking for a quick refresher on how telegraf handles the files in telegraf.d. my understanding is it globs all of them to build a single file (internally) which is loaded. As I was looking for something else I came across TELEGRAF - metric_batch_size & metric_buffer_limit not working - #13 by jpowers which seems to imply that the order of the files, possibly including telegraf.d dir, can impact the configuration. The best practices blog recommends splitting things up into manageable chunks (we do this today) but if the order of the files can matter, we want to update our naming so that agent things are loaded first (think 000- prefix), processors, inputs, and then outputs (how we structure our chunks) assuming a “alphanumeric sort” on glob of the files in the telegraf.d directory

I’m not exactly sure how it handles them in the telegraf.d folder (whether it loads them as one or not), however, what you are saying about making sure you have agent things loaded first wouldn’t matter in the scenario either way. From my experience it is only going to use the first agent config that it finds. So ordering them isn’t going to help or change anything because only 1 will be used anyways, no matter what order you have your files. When I figured this out I just made 1 agent file and 1 output file in the telegraf.d folder and then removed all of that from every other file so that they were much shorter. Otherwise it’s just duplicating configuration that won’t be used anyways.

Having multiple agent sections over multiple files is discouraged, but I can tell that they aren’t replaced, but actually get merged. Of course, duplicates will be overridden, so maybe it’s a combination?

For your scenario on how you split your configs, the ordering of the files wouldn’t matter. So there’s no need to prefix them.

Appreciate the input and sorry for any confusion. I did not mean to imply that we do or even anticipate multiple agent sections. To go into more detail on our setup, we have a single agent file, multiple processors (for tag routing; for the most part these are in a single file but have some in specific inputs), multiple inputs, and a single output. Each of these are files

I was more concerned with ordering. From the community post I linked, it sounded like they had outputs loaded first which caused, in their case, the flush interval to use the app default versus their configured default. To that end, I wanted to know if I should make sure the ordering of our files is better defined to ensure we do not hit a situation like that were someone names something a-output.conf but we have things defined in base.conf (our agent) that should have a different value than the app default but because of the order they are read in, the parameters in use may not be what is expected

There is no guaranteed order at all. Best is to place general config in telegraf.conf and then the others in telegraf.d directory.