# Filebeat input paths don't read environment variables

**URL:** https://discuss.elastic.co/t/filebeat-input-paths-dont-read-environment-variables/85314
**Category:** Beats
**Tags:** filebeat
**Created:** [May 10, 2017, 11:06pm UTC](https://discuss.elastic.co/t/filebeat-input-paths-dont-read-environment-variables/85314 "2017-05-10T23:06:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mtCarto](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mtCarto](https://discuss.elastic.co/u/mtCarto)
#### Post date: [May 10, 2017, 11:06pm UTC](https://discuss.elastic.co/t/filebeat-input-paths-dont-read-environment-variables/85314/1 "2017-05-10T23:06:02Z")

</div>

I've got a simple prospector setup:

```
filebeat.prospectors:
   - input_type: log
     paths: 
        - '${REGISTRY_LOG_FILE_PATH:/tmp/fake.log}'
       # - /var/tmp/registry/registry.log
     type: ${FILEBEAT_TYPE}  

```

The REGISTRY\_LOG\_FILE\_PATH is not read in, so it defaults to the fake.log. However, environment variables are read in fine anywhere else in the file, such as FILEBEAT\_TYPE. I haven't been able to find any examples of an input path specified via Env. Vars, is this supported?

The docs ([Environment variables | Beats Platform Reference [8.11] | Elastic](https://www.elastic.co/guide/en/beats/libbeat/current/config-file-format-env-vars.html)) mention:

> Environment variables usage in namespace and setting names are not supported.

Is the path considered part of a setting name or a namespace? My initial impression was that it should work as its a value for the input?

---

<div class="post-metadata">

### Author: ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)
#### Post date: [May 11, 2017, 8:33am UTC](https://discuss.elastic.co/t/filebeat-input-paths-dont-read-environment-variables/85314/2 "2017-05-11T08:33:51Z")

</div>

Hi!

I've just tested this and it worked for me with the same exact settings, could you please give more details on your filebeat version, os version and how you launch filebeat (with the env variable)?

Best regards

---

<div class="post-metadata">

### Author: ![mtCarto](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mtCarto](https://discuss.elastic.co/u/mtCarto)
#### Post date: [May 11, 2017, 4:49pm UTC](https://discuss.elastic.co/t/filebeat-input-paths-dont-read-environment-variables/85314/3 "2017-05-11T16:49:50Z")

</div>

I''m using Filebeat 5.3.2 on MacOS 10.12.4.

I have the REGISTRY\_LOG\_FILE\_PATH and FILEBEAT\_TYPE set in my terminals environment. I launch Filebeat with `sudo ./filebeat -e -c boundless-registry.yml -d "publish"`

---

<div class="post-metadata">

### Author: ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)
#### Post date: [May 11, 2017, 7:25pm UTC](https://discuss.elastic.co/t/filebeat-input-paths-dont-read-environment-variables/85314/4 "2017-05-11T19:25:21Z")

</div>

I think you have to add `-E` parameter to `sudo`, env vars are not carried over to filebeat with your current command:

```
     -E, --preserve-env
             Indicates to the security policy that the user wishes to preserve their existing environment vari‐
             ables. The security policy may return an error if the user does not have permission to preserve
             the environment.
```

---

<div class="post-metadata">

### Author: ![mtCarto](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mtCarto](https://discuss.elastic.co/u/mtCarto)
#### Post date: [May 11, 2017, 7:46pm UTC](https://discuss.elastic.co/t/filebeat-input-paths-dont-read-environment-variables/85314/5 "2017-05-11T19:46:50Z")

</div>

The -E flag solved the issue. This might be worth mentioning as a note in the Stating Filebeat docs.

Thank you

---

<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: [June 8, 2017, 7:50pm UTC](https://discuss.elastic.co/t/filebeat-input-paths-dont-read-environment-variables/85314/6 "2017-06-08T19:50:44Z")

</div>

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