Invalid TOML syntax

Hi team,
I am completely new to influxdb and this is my first time trying to setup telegraf, anyhow when i try to run the config file it generate the error as per below attached snap, hope somebody can help me out in this.

You need to show us what your config file looks like :wink:

Hi jpowers,
Thanks for your speedy reply. Please find the config file screen shot, hope this helps

that’s pretty hard to read, but I am going to assume your first line is [global_tags]? Which looks right.

Honestly you are going to watch either:

a) run your config through a TOML validator and get a better idea of what is up
b) print your config file with comments removed

Open the telegraf.conf file in Notepad++ and check the file encoding/character set.

I just ran into this when using --config-directory (one config file worked, the other gave this error). First comparing with WinMerge, found the encoding/character set on the offending config file to be different (working: UTF-8 , error: UCS-2 BOM). I changed the encoding with Notepad++ (Click on “Encoding” in the File menu, select UTF-8, save the file.) Retried telegraf and the config loaded without the error; no other change to the file. If this works for you, I think the hint is in the “error parsing data: line 1”.

— Some more context and info
It seems this stemmed from creating the second config file using “>” (and “>>”) in PowerShell; the result of a file echoing content >> into a file. The following thread talks about default encoding of “>”, “>>”, and “Out-File” in PowerShell and how to set it (see this thread).

Typing this in PowerShell before creating the config file the way I was doing it

$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8'

yielded an output config file that is usable (UTF-8).