SQLServer Secret error

Hi,

I want to use SQLserver plugin with secret pw but cannot make it work:

Here’s my config:

[[secretstores.os]]
id = “store”
[[inputs.sqlserver]]
servers = [
“Server=IP\MSSQLSERVER;Port=1433;User ID=telegraf;Password=@{store:sql2};app name=telegraf;log=1;”,
]

I created the secret using this:

telegraf --config /etc/telegraf/telegraf.conf secrets set store sql2

After starting the instance I get the following error message:
Error: mssql: login error: Login failed for user ‘telegraf’.

If I type the password into the config file everything works fine.

Is there anyone who as an advice?

Thanks,

What version of telegraf?

Are you running telegraf as a service?

If you use the secrets subcommand to get the secret does it show correctly?

I was on 1.25.2 but today I updated it to 1.27.1.

Yes I’m running it as a service with user telegraf.

With root I get the pw back with the command telegraf secrets list --reveal-secret store but not with telegraf user so probably that’s the problem.

Do you know how can I grant access for telegraf user as well? I’m running Redhat7.

Thanks,

Yes that is correct.

You need to run those commands as the telegraf user so that the secrets are stored in the telegraf user’s keyring.

1 Like