# Telegraf / Server Hostname instead of id

**URL:** https://community.influxdata.com/t/telegraf-server-hostname-instead-of-id/26000
**Category:** Telegraf
**Tags:** influxdb, grafana, docker
**Created:** [August 4, 2022, 3:13pm UTC](https://community.influxdata.com/t/telegraf-server-hostname-instead-of-id/26000 "2022-08-04T15:13:43Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![neosaiyan](https://avatars.discourse-cdn.com/v4/letter/n/e47c2d/32.png) [@neosaiyan](https://community.influxdata.com/u/neosaiyan)
#### Post date: [September 2, 2022, 1:30pm UTC](https://community.influxdata.com/t/telegraf-server-hostname-instead-of-id/26000/14 "2022-09-02T13:30:13Z")

</div>

Ok i found the solution on another topic

> [@Incorrect hostname picked up by Telegraf (docker container)](https://community.influxdata.com/t/incorrect-hostname-picked-up-by-telegraf-docker-container/24469/5):
>
> That explains it, very good to know. That seems to be the only option from the looks of it. As I’m deploying from a compose file, and the telegraf configuration is parsed when the container runs, I need to figure out a way to make this dynamic so that the environment variable matches each host it runs on. It would be great to have the ability to provide a file, as opposed to a value, similar to how it works when using Docker Secrets. At this point I think it’s clear that the issue is no long…

you must put this on the docker-compose  
telegraf:  
image: telegraf:1.21 # not the latest  
**hostname: “{{.Node.Hostname}}”**

Thanks for the helping

---

_[View the full topic](https://community.influxdata.com/t/telegraf-server-hostname-instead-of-id/26000)._
