Problem
Sometimes when creating configuration for Terraform Enterprise log forwarding , JSON that is at first glance correct, after adding could produce following lines upon startup :
2022-03-16T13:57:06.096171000Z [2022/03/16 13:57:06] [ Error] File /fluent-bit/etc/fluent-bit.conf
2022-03-16T13:57:06.096356000Z [2022/03/16 13:57:06] [ Error] Error in line XX: Invalid indentation level
...
2022-03-16T13:57:06.096643000Z [1m[91mError[0m: Configuration file contains errors. Aborting
Possible causes
Fluent Bit configuration files are based in a strict Indented Mode, that means that each configuration file must follow the same pattern of alignment from left to right when writing text. By default an indentation level of four spaces from left to right is suggested.
So what can be the cause for the error above is one of the two :
- Your file, the one that you've added to TFE has incosistent indent across lines. For eample one 3 - 3 spaces, another 5 and etc.
- You are not using 4-spaces indent, and because there is already some configuration present for Fluent-bit service in TFE that is using recommended four spaces - your new config is not fitting with existing one.
Solution
Use 4-step indent for configuration and use some JSON-lint to test it for validity before submitting into TFE
Additional information could be found here :