Watch config failing to start telegraf

I am using below command
/app/telegraf --config /app/telegraf.conf --watch-config notify

telegraf is able to restart but getting below error, even when config file has outputs

Config watcher started
Config file modified
Reloading Telegraf config
[inputs.statsd] Stopping the statsd service
[inputs.statsd] Stopped listener service on ":8125"
[agent] Hang on, flushing any cached metrics before shutdown
[agent] Stopping running outputs
Loading config: /app/telegraf.conf
Config watcher started
Config file modified
Reloading Telegraf config
[telegraf] Error running agent: no outputs found, did you provide a valid config file?

Please provide solution for this.

@snehal520 did you read the error message? You need to specify at least one output in your configs…

@srebhan I do have output in my config file, same config is working properly prior restart by telegraf.

show us :wink: what is in /app/telegraf.conf

Config file modified
Reloading Telegraf config

This would indicate that you edited the file. Did you remove any [[outputs...?

@jpowers I was just testing --watch-config feature by putting the same config file.

[agent]
interval = “60s”
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = “0s”
flush_interval = “60s”
flush_jitter = “0s”
precision = “”
logtarget = “file”
logfile = “/logs/telegraf.log”
omit_hostname = true
always_include_global_tags = true

[[inputs.statsd]]
namepass = [
“PrestartTelegraf”
]
protocol = “udp”
service_address = “:9100”
delete_gauges = true
delete_counters = true
delete_sets = true
delete_timings = true
metric_separator = “.”
parse_data_dog_tags = false
datadog_extensions = false
allowed_pending_messages = 10000

[[outputs.file]]
files = [“stdout”, “/logs/metrics.log”]
use_batch_format = false
rotation_interval = “1d”
rotation_max_archives = 7
data_format = “influx”

What do you mean by this?

Can you please 1) spell out the exact steps you took, 2) how you changed the config file please, and 3) provide the full logs with version.

@jpowers I missed one step, as intermediate step conf did not had outputs. After fixing that it is working smoothly. Thanks

2 Likes