# Why doesn't add\_tag =\> \["${HOSTNAME}"\] work?

**URL:** <https://discuss.elastic.co/t/why-doesnt-add-tag-hostname-work/129366>\
**Category:** Logstash\
**Created:** [April 24, 2018, 6:36pm UTC](https://discuss.elastic.co/t/why-doesnt-add-tag-hostname-work/129366 "2018-04-24T18:36:07Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![JimP](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@JimP](https://discuss.elastic.co/u/JimP)\
**Post date:** [April 26, 2018, 12:44am UTC](https://discuss.elastic.co/t/why-doesnt-add-tag-hostname-work/129366/19 "2018-04-26T00:44:09Z")

</div>

@magnusbaeck, With the help of elastic support, we figured this out. Turns out it was 2 easy changes to get it working. I am not saying that it was easy figuring this out, because it wasn't easy!

```
mutate {
  add_tag => ["${HOSTNAME}"]
}

```

- Add xpack.management.pipeline.id: to logstash.yml
- Create file, /etc/sysconfig/logstash, (chmod 600) and add these 2 lines
  - HOSTNAME=ThisHostName
  - LOGSTASH\_KEYSTORE\_PASS=password

Thanks again for your help!

---

_[View the full topic](https://discuss.elastic.co/t/why-doesnt-add-tag-hostname-work/129366)._
