# Need program variables from config file

**URL:** <https://discuss.elastic.co/t/need-program-variables-from-config-file/51300>\
**Category:** Logstash\
**Created:** [May 30, 2016, 9:45am UTC](https://discuss.elastic.co/t/need-program-variables-from-config-file/51300 "2016-05-30T09:45:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![billzy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/billzy/32/9967_2.png) [@billzy](https://discuss.elastic.co/u/billzy)\
**Post date:** [May 30, 2016, 9:45am UTC](https://discuss.elastic.co/t/need-program-variables-from-config-file/51300/1 "2016-05-30T09:45:13Z")

</div>

I'm using logstash as output method for packetbeat and I want to filter transactions in logstash, for example, I received 3 packets described as below

packet A is from 192.168.0.3 to 192.168.0.4  
packet B is from 192.168.0.3 to 192.168.0.5  
packet C is from 192.168.0.3 to 10.0.168.9

now I need logstash only output packet C, what i'm thinking now is to maintain a whitelist read from some config file in logstash, any packet compliant with this list will output and others won't.

Does logstash have this kind of feature ? or any workaround I can take ?  
thanks a lot !

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 30, 2016, 11:16pm UTC](https://discuss.elastic.co/t/need-program-variables-from-config-file/51300/2 "2016-05-30T23:16:46Z")

</div>

I don't know if there is a way to do this, packetbeat stores hostnames rather than IPs for the most part. It does store a `client_ip` though, so maybe you can use that?

---

<div class="post-metadata">

**Author:** ![billzy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/billzy/32/9967_2.png) [@billzy](https://discuss.elastic.co/u/billzy)\
**Post date:** [May 31, 2016, 7:15am UTC](https://discuss.elastic.co/t/need-program-variables-from-config-file/51300/3 "2016-05-31T07:15:01Z")

</div>

thanks for the reply, finally I figured out a way using a new experimental feature in the latest version 2.3.2 to workaround this, the new feature allows logstash to read system environment variables, after that I use mutate to add a new field contains the desired content, then I can do filter efforts in ruby code.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 31, 2016, 7:36am UTC](https://discuss.elastic.co/t/need-program-variables-from-config-file/51300/4 "2016-05-31T07:36:39Z")

</div>

This sounds like a good task for the translate filter.

---

<div class="post-metadata">

**Author:** ![billzy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/billzy/32/9967_2.png) [@billzy](https://discuss.elastic.co/u/billzy)\
**Post date:** [May 31, 2016, 7:47am UTC](https://discuss.elastic.co/t/need-program-variables-from-config-file/51300/5 "2016-05-31T07:47:35Z")

</div>

oh god that seems exactly what i need by reading the translate document page, many 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:** [July 6, 2017, 4:55am UTC](https://discuss.elastic.co/t/need-program-variables-from-config-file/51300/6 "2017-07-06T04:55:22Z")

</div>

Closed on July 6, 2017, 4:55am UTC


