# Filebeat not loading env variables

**URL:** <https://discuss.elastic.co/t/filebeat-not-loading-env-variables/258328>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [December 10, 2020, 7:17pm UTC](https://discuss.elastic.co/t/filebeat-not-loading-env-variables/258328 "2020-12-10T19:17:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![francom1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francom1/32/80628_2.png) [@francom1](https://discuss.elastic.co/u/francom1)\
**Post date:** [December 10, 2020, 7:17pm UTC](https://discuss.elastic.co/t/filebeat-not-loading-env-variables/258328/1 "2020-12-10T19:17:48Z")

</div>

Hello everyone! I'm using this filebeats installation script in my deploys to ec2.

```auto
    files:
      "/etc/filebeat/filebeat.yml":
        mode: "000755"
        owner: root
        group: root
        content: |
          filebeat.prospectors:
          - input_type: log
            paths:
              - /var/log/eb-engine.log
              - /var/log/puma/puma.log
              - /var/app/current/log/sidekiq.log
              - /var/app/current/log/staging.log
              - /var/app/current/log/production.log
            exclude_lines: ['^[[:space:]]*$']
            multiline:
              # Order for pattern: 'eb-engine, sidekiq and staging|puma'
              pattern: '^\s*(([I,V,E,W,L], ){0,1}\[{0,1}2[0-9]{3}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}|=== |.*\[[a-z,0-9,\-]{36}\]( Started| Sending| $))'
              negate: true
              match: after
            fields:
              appname: appname
              appcomponent: appcomponent
              environment: ${ELK_ENV:empty_value}
          output.logstash:
            hosts: ["my_host"]
    container_commands:
      1_command:
        command: "curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.8.2-x86_64.rpm"
        cwd: /home/ec2-user
      2_command:
        command: "rpm -ivh --replacepkgs filebeat-6.8.2-x86_64.rpm"
        cwd: /home/ec2-user
      3_command:
        command: "/etc/init.d/filebeat stop"
      4_command:
        command: "/etc/init.d/filebeat start"

```

This file is placed in my `.ebextensions` folder of my project. This same script is working fine in two other projects, but in this new one it's not working as expected, as I see in my Kibana dashboard that the logs are coming from `appname-empty_value` instead of `appname-development`. So, I'm not entirely sure why my `environment: ${ELK_ENV:empty_value}` it's not taking the env var 🤔. The only difference is this new project, is that's running on Amazon Linux 2 platform. Any hint?

Thanks in advanced.

---

<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:** [January 7, 2021, 9:17pm UTC](https://discuss.elastic.co/t/filebeat-not-loading-env-variables/258328/2 "2021-01-07T21:17:49Z")

</div>

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