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

overriding hostname stopped working #15594

Closed
fireba11 opened this issue Jul 5, 2024 · 4 comments
Closed

overriding hostname stopped working #15594

fireba11 opened this issue Jul 5, 2024 · 4 comments
Labels
bug unexpected problem or unintended behavior waiting for response waiting for response from contributor

Comments

@fireba11
Copy link

fireba11 commented Jul 5, 2024

Relevant telegraf.conf

## Override default hostname, if empty use os.Hostname()
  hostname = "my.host.name"
  ## If set to true, do no set the "host" tag in the telegraf agent.
  omit_hostname = false

Logs from Telegraf

no log

System info

telegraf > 1.25

Docker

No response

Steps to reproduce

  1. set a hostname
  2. check your influxdb

Expected behavior

configured hostname is used

Actual behavior

value is ignoried, system hostname is used
this is a major bug for usage with docker

Additional info

No response

@fireba11 fireba11 added the bug unexpected problem or unintended behavior label Jul 5, 2024
@fireba11
Copy link
Author

fireba11 commented Jul 5, 2024

I think i had this back in 1.26 as issue but i can't find it anymore. At least current 1.31 ignores hostname, running tests for other versions now.

@powersj
Copy link
Contributor

powersj commented Jul 8, 2024

At least current 1.31 ignores hostname

Using this config:

[agent]
  debug = true
  hostname = "foobar"
  omit_hostname = false

[[outputs.file]]

[[inputs.exec]]
  commands = ["echo metric value=42"]
  data_format = "influx"

Produces:

❯ ./telegraf --config config.toml --once
2024-07-08T12:56:02Z I! Loading config: config.toml
2024-07-08T12:56:02Z I! Starting Telegraf 1.32.0-94e45a1e brought to you by InfluxData the makers of InfluxDB
2024-07-08T12:56:02Z I! Available plugins: 234 inputs, 9 aggregators, 32 processors, 26 parsers, 60 outputs, 6 secret-stores
2024-07-08T12:56:02Z I! Loaded inputs: exec
2024-07-08T12:56:02Z I! Loaded aggregators: 
2024-07-08T12:56:02Z I! Loaded processors: 
2024-07-08T12:56:02Z I! Loaded secretstores: 
2024-07-08T12:56:02Z I! Loaded outputs: file
2024-07-08T12:56:02Z I! Tags enabled: host=foobar
2024-07-08T12:56:02Z D! [agent] Initializing plugins
2024-07-08T12:56:02Z D! [agent] Connecting outputs
2024-07-08T12:56:02Z D! [agent] Attempting connection to [outputs.file]
2024-07-08T12:56:02Z D! [agent] Successfully connected to outputs.file
2024-07-08T12:56:02Z D! [agent] Starting service inputs
2024-07-08T12:56:02Z D! [agent] Stopping service inputs
2024-07-08T12:56:02Z D! [agent] Input channel closed
2024-07-08T12:56:02Z I! [agent] Hang on, flushing any cached metrics before shutdown
metric,host=foobar value=42 1720443362000000000
2024-07-08T12:56:02Z D! [outputs.file]  Wrote batch of 1 metrics in 19.76µs
2024-07-08T12:56:02Z D! [outputs.file]  Buffer fullness: 0 / 10000 metrics
2024-07-08T12:56:02Z I! [agent] Stopping running outputs
2024-07-08T12:56:02Z D! [agent] Stopped Successfully

We would need a way to reproduce.

@powersj powersj added the waiting for response waiting for response from contributor label Jul 8, 2024
@powersj
Copy link
Contributor

powersj commented Jul 8, 2024

After the team and I chatted, we noticed you only provided the two config options. Can you provide your whole config? Do you have multiple agent config sections?

I still find it highly unlikely that this option was broken since 1.25, as that would be more than a year and we have people using this.

@telegraf-tiger telegraf-tiger bot removed the waiting for response waiting for response from contributor label Jul 8, 2024
@powersj powersj added the waiting for response waiting for response from contributor label Jul 8, 2024
@telegraf-tiger
Copy link
Contributor

Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Forums or provide additional details in this issue and reqeust that it be re-opened. Thank you!

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 waiting for response waiting for response from contributor
Projects
None yet
Development

No branches or pull requests

2 participants