Skip to content

Logs not being captured up by inputs.exec #18508

@network-monitoring

Description

@network-monitoring

Relevant telegraf.conf

[[inputs.exec]]
  commands = ["/etc/telegraf/testscript.py"]
  data_format = "influx"

Logs from Telegraf

026-03-10T21:14:08Z I! Loading config: telegraf.conf
2026-03-10T21:14:08Z I! Starting Telegraf 1.38.0 brought to you by InfluxData the makers of InfluxDB
2026-03-10T21:14:08Z I! Available plugins: 244 inputs, 9 aggregators, 35 processors, 26 parsers, 68 outputs, 8 secret-stores
2026-03-10T21:14:08Z I! Loaded inputs: exec
2026-03-10T21:14:08Z I! Loaded aggregators:
2026-03-10T21:14:08Z I! Loaded processors:
2026-03-10T21:14:08Z I! Loaded secretstores:
2026-03-10T21:14:08Z W! Outputs are not used in testing mode!
2026-03-10T21:14:08Z I! Tags enabled: host=ubuntu
2026-03-10T21:14:08Z W! [agent] The default value of 'skip_processors_after_aggregators' will change to 'true' with Telegraf v1.40.0! If you need the current default behavior, please explicitly set the option to 'false'!
2026-03-10T21:14:08Z D! [agent] Initializing plugins
2026-03-10T21:14:08Z D! [agent] Starting service inputs
2026-03-10T21:14:08Z D! [agent] Stopping service inputs
2026-03-10T21:14:08Z D! [agent] Input channel closed
> TSDB_output,host=ubuntu,test=test value=1 1773177249000000000
2026-03-10T21:14:08Z D! [agent] Stopped Successfully

System info

Ubuntu 24.04.4

Docker

No response

Steps to reproduce

  1. Create Telegraf config with config above.
  2. Create Python script to print test output along with a warning message
  3. Execute config
    ...

Expected behavior

Telegraf would have emitted the warning error that was printed to stderr also. i.e.

2026-03-10T21:14:08Z D! [agent] Input channel closed

TSDB_output,host=ubuntu,test=test value=1 1773177249000000000
2026-03-10T21:14:08Z E! [telegraf] Error running agent: Error alarm from this script
2026-03-10T21:14:08Z D! [agent] Stopped Successfully

Actual behavior

Telegraf is ignoring / excluding error sent to stderr

Additional info

Python Script to recreate:

#!/usr/bin/python3

import sys

print("TSDB_output,test=test value=1")
print("Error alarm from this script", file=sys.stderr)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions