Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template serializer does not work on #15739

Closed
sebastianrothbucher opened this issue Aug 13, 2024 · 0 comments · Fixed by #15740
Closed

Template serializer does not work on #15739

sebastianrothbucher opened this issue Aug 13, 2024 · 0 comments · Fixed by #15740
Labels
bug unexpected problem or unintended behavior

Comments

@sebastianrothbucher
Copy link
Contributor

Relevant telegraf.conf

[[outputs.mqtt]]
  servers = ["localhost:1883", ]
  topic = 'telegraf/{{ .Tag "topic" }}'
  batch = false
  data_format = "template"
  template = '{{ .Field "msg" }}'
[[inputs.mqtt_consumer]]
  servers = ["tcp://127.0.0.1:1883"]
  topics = [ "test/#" ]
  data_format = "value"
  data_type = "string"
  value_field_name = "msg"

Logs from Telegraf

2024-08-13T23:00:25Z E! [serializers.template::mqtt] metric of type *metric.trackingMetric is not a template metric

System info

Telegraf 1.31.3 (MacOS Silicon)

Docker

No response

Steps to reproduce

  1. run above config (i.e. bridge messages verbatim)
  2. send mqtt to test/one (or test/something)
  3. observe error and empty message being written to telegraf/test/one

Expected behavior

Incoming message is written to outgoing topic verbatim

Actual behavior

Message is empty

Additional info

I already have a fix for this, can submit a PR shortly.

@sebastianrothbucher sebastianrothbucher added the bug unexpected problem or unintended behavior label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant