# Logstash environment filter plugin

**URL:** <https://discuss.elastic.co/t/logstash-environment-filter-plugin/178170>\
**Category:** Logstash\
**Created:** [April 24, 2019, 7:40am UTC](https://discuss.elastic.co/t/logstash-environment-filter-plugin/178170 "2019-04-24T07:40:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gomathi\_Meena](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gomathi_meena/32/43086_2.png) [@Gomathi\_Meena](https://discuss.elastic.co/u/Gomathi_Meena)\
**Post date:** [April 24, 2019, 7:40am UTC](https://discuss.elastic.co/t/logstash-environment-filter-plugin/178170/1 "2019-04-24T07:40:51Z")

</div>

Hi .  
I have been trying to know the purpose of **environment filter** for a while But at last it came with no effect in my data index in elastic search  
Can anyone tell me the purpose of environment filter and what the mistake in my config file.?  
Here the config looks like ,

```
  environment {
  add_metadata_from_env => { "target_env" => "$HOME" }
}

```

**Platform:**  
os : ubuntu18.04  
logstash : 6.7

Thanks in advance .

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 24, 2019, 1:41pm UTC](https://discuss.elastic.co/t/logstash-environment-filter-plugin/178170/2 "2019-04-24T13:41:25Z")

</div>

> [@Gomathi\_Meena](#):
>
> add\_metadata\_from\_env =\> { "target\_env" =\> "$HOME" }

That should be

```
add_metadata_from_env => { "target_env" => "HOME" }

```

Personally I don't see any point in installing the environment filter when every filter supports environment variable references

```
mutate { add_field => { "[@metadata][target_env]" => "${HOME}" } }

```

---

<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:** [May 22, 2019, 1:41pm UTC](https://discuss.elastic.co/t/logstash-environment-filter-plugin/178170/3 "2019-05-22T13:41:26Z")

</div>

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