# Use ${hostname} in var.paths

**URL:** <https://discuss.elastic.co/t/use-hostname-in-var-paths/155451>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [November 5, 2018, 7:42pm UTC](https://discuss.elastic.co/t/use-hostname-in-var-paths/155451 "2018-11-05T19:42:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shiv94](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shiv94](https://discuss.elastic.co/u/shiv94)\
**Post date:** [November 5, 2018, 7:42pm UTC](https://discuss.elastic.co/t/use-hostname-in-var-paths/155451/1 "2018-11-05T19:42:42Z")

</div>

Having 3 nodes in a cluster, enabled elasticsearch module and setting the var.paths to elasticsearch logs path. In these 3 nodes logs are at /var/log/elasticsearch/{hostname}/\*.log. Trying to replace the var.paths in all the nodes at once by using /var/log/elasticsearch/{hostname}/\*.log

- module: elasticsearch  
server:  
enabled: true  
var.paths: ["/var/log/elasticsearch/${hostname}/\*.log"]

Can we add the parameter hostname directly or do we have any other option? Please help me out.

---

<div class="post-metadata">

**Author:** ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)\
**Post date:** [November 6, 2018, 11:03am UTC](https://discuss.elastic.co/t/use-hostname-in-var-paths/155451/2 "2018-11-06T11:03:38Z")

</div>

Filebeat can be parametrized using environment variables in the configuration file: [https://www.elastic.co/guide/en/beats/filebeat/6.4/using-environ-vars.html](https://www.elastic.co/guide/en/beats/filebeat/6.4/using-environ-vars.html)

---

<div class="post-metadata">

**Author:** ![shiv94](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shiv94](https://discuss.elastic.co/u/shiv94)\
**Post date:** [November 7, 2018, 8:56pm UTC](https://discuss.elastic.co/t/use-hostname-in-var-paths/155451/3 "2018-11-07T20:56:33Z")

</div>

I enabled the elasticsearch module and changed the var.paths as following

- module: elasticsearch  
server:  
enabled: true  
var.path: ["/var/log/elasticsearch/server1/\* .log"]  
gc:  
enabled: true  
var.paths: ["/var/log/elasticsearch/server1/gc.log.[0-9]\*"]

In the filebeat logs configured path for server logs is showing as "/var/log/elasticsearch/\*.log" its considering the default path why?

2018-11-07T15:45:20.339-0500 INFO crawler/crawler.go:72 Loading Inputs: 1  
2018-11-07T15:45:20.344-0500 INFO log/input.go:138 Configured paths: [/var/log/elasticsearch/server1/\* \_access.log]  
2018-11-07T15:45:20.345-0500 INFO log/input.go:138 Configured paths: [/var/log/elasticsearch/server1/\* \_deprecation.log]  
2018-11-07T15:45:20.390-0500 INFO log/input.go:138 Configured paths: [/var/log/elasticsearch/server1/gc.log.[0-9]\* ]  
2018-11-07T15:45:20.391-0500 INFO log/input.go:138 Configured paths: [/var/log/elasticsearch/ \* .log]  
2018-11-07T15:45:20.392-0500 INFO log/input.go:138 Configured paths: [/var/log/elasticsearch/server1/\* \_index\_search\_slowlog.log]  
2018-11-07T15:45:23.282-0500 INFO log/input.go:138 Configured paths: [/var/log/logstash/logstash-plain\*.log]  
2018-11-07T15:45:23.283-0500 INFO log/input.go:138 Configured paths: [/var/log/logstash/logstash-slowlog-plain\*.log]  
2018-11-07T15:45:23.323-0500 INFO log/input.go:138 Configured paths: [/var/log/auth.log\* /var/log/secure\*]  
2018-11-07T15:45:23.364-0500 INFO log/input.go:138 Configured paths: [/var/log/messages\* /var/log/syslog\*]  
2018-11-07T15:45:23.364-0500 INFO crawler/crawler.go:106 Loading and starting Inputs completed. Enabled inputs: 0

---

<div class="post-metadata">

**Author:** ![shiv94](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shiv94](https://discuss.elastic.co/u/shiv94)\
**Post date:** [November 8, 2018, 1:39pm UTC](https://discuss.elastic.co/t/use-hostname-in-var-paths/155451/4 "2018-11-08T13:39:16Z")

</div>

can anyone help me with this?

---

<div class="post-metadata">

**Author:** ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)\
**Post date:** [November 8, 2018, 2:43pm UTC](https://discuss.elastic.co/t/use-hostname-in-var-paths/155451/5 "2018-11-08T14:43:31Z")

</div>

It's possible your configuration is incorrect. Could you please format it using `</>`, so whitespaces are preserved?

---

<div class="post-metadata">

**Author:** ![shiv94](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shiv94](https://discuss.elastic.co/u/shiv94)\
**Post date:** [November 8, 2018, 3:25pm UTC](https://discuss.elastic.co/t/use-hostname-in-var-paths/155451/6 "2018-11-08T15:25:55Z")

</div>

Works, Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 6, 2018, 3:34pm UTC](https://discuss.elastic.co/t/use-hostname-in-var-paths/155451/7 "2018-12-06T15:34:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
