Telegraf conf parse error for tagdrop

Hi,

When upgrading telegraf from 1.17.2 to 1.21.4 I see a parse error in telegraf.conf file when starting telegraf container

telegraf.conf file:

[[outputs.influxdb]]
urls = [“https://influx-uat.dev.io:443”]
database = “infra”
skip_database_creation = true
precision = “ns”
retention_policy = “”
write_consistency = “any”
timeout = “5s”
username = “admin”
password = “admin”
namepass = [“apache”
]
[outputs.influxdb.tagdrop]
tagSource = [“statsd”]
ssl_cert = “/etc/telegraf/influxdb.crt”
ssl_key = “/etc/telegraf/influxdb.key”
insecure_skip_verify = false

Error
E! [telegraf] Error running agent: Error loading config file /etc/telegraf/telegraf.conf: error parsing influxdb array, line 61:{1692 2236}: found unexpected format while parsing "tagdrop", expecting string array/slice format on each entry

I am seeing this error from telegraf version > 1.19.

Any recommendations to change the telegraf conf

Hey @jeevan1205!

You cannot mix the options in the way you do as the documentation states:

NOTE: Due to the way TOML is parsed, tagpass and tagdrop parameters must be defined at the end of the plugin definition, otherwise subsequent plugin config options will be interpreted as part of the tagpass/tagdrop tables.

In your case you need to move the tagdrop down

[[outputs.influxdb]]
  urls = [“https://influx-uat.dev.io:443”]
  database = “infra”
  skip_database_creation = true
  precision = “ns”
  retention_policy = “”
  write_consistency = “any”
  timeout = “5s”
  username = “admin”
  password = “admin”
  ssl_cert = “/etc/telegraf/influxdb.crt”
  ssl_key = “/etc/telegraf/influxdb.key”
  insecure_skip_verify = false
  namepass = [“apache”]

  [outputs.influxdb.tagdrop]
    tagSource = [“statsd”]
1 Like

Thank you, this works as required.

1 Like