Skip to content

Add tags in logger output #18610

@Zegorax

Description

@Zegorax

Use Case

We have a lot of different configurations using inputs.execd and inputs.exec. When they fail, it's difficult to identify exactly which one failed from the log output.

This feature request is about adding the set of tags in the logger output when using logformat = "structured".

It's particularly useful when using a log ingestion service (in our case, VictoriaLogs). When we have an error, we directly query the log database and add it as an annotation in the firing alert.

Expected behavior

When Telegraf outputs a log line in JSON, the following would be printed :
{"time":"2026-03-27T09:14:36.078389805Z","level":"INFO","msg":"Error connecting to target. Restarting in 10s...","category":"inputs","plugin":"execd","tags":{"server_host":"10.0.1.20","friendly_name":"friendly_server_name","log_source":"telegraf","metric_type":"logs"}}

Actual behavior

Currently, the JSON output only includes the following :
{"time":"2026-03-27T09:14:36.078389805Z","level":"INFO","msg":"Error connecting to target. Restarting in 10s...","category":"inputs","plugin":"execd"}

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequests for new plugin and for new features to existing plugins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions