# How do you store variables for logstash?

**URL:** <https://discuss.elastic.co/t/how-do-you-store-variables-for-logstash/90654>\
**Category:** Logstash\
**Created:** [June 23, 2017, 2:40pm UTC](https://discuss.elastic.co/t/how-do-you-store-variables-for-logstash/90654 "2017-06-23T14:40:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcanzanese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rcanzanese/32/12626_2.png) [@rcanzanese](https://discuss.elastic.co/u/rcanzanese)\
**Post date:** [June 23, 2017, 2:40pm UTC](https://discuss.elastic.co/t/how-do-you-store-variables-for-logstash/90654/1 "2017-06-23T14:40:21Z")

</div>

There are a few things that I am doing in logstash for which I would like to store variables in a file that is separate from the logstash filter configs themselves. For example, I am using the CIDR filter in a few different environments. Each one of them has different CIDR blocks and tags that I want to apply.

Is there some way that I can store the CIDR blocks and tags somewhere other than within the logstash filter file itself? I want to avoid having to edit my core logstash filters in each environment.

Has anyone done something like this? Or should I just use templates (ansible, etc.) to generate the appropriate code in my logstash files?

---

<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:** [June 24, 2017, 7:10pm UTC](https://discuss.elastic.co/t/how-do-you-store-variables-for-logstash/90654/2 "2017-06-24T19:10:08Z")

</div>

I'd say generate your configuration files. That said, there is an open pull request for the cidr filter that adds the possibility to load network patterns from a file. I'll review it tomorrow so it might be released fairly soon.

> <https://github.com/logstash-plugins/logstash-filter-cidr/pull/9>

---

<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 22, 2017, 7:10pm UTC](https://discuss.elastic.co/t/how-do-you-store-variables-for-logstash/90654/3 "2017-07-22T19:10:11Z")

</div>

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