# Modify logstash conf through script

**URL:** <https://discuss.elastic.co/t/modify-logstash-conf-through-script/63235>\
**Category:** Logstash\
**Created:** [October 17, 2016, 11:41pm UTC](https://discuss.elastic.co/t/modify-logstash-conf-through-script/63235 "2016-10-17T23:41:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shankarbala](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@shankarbala](https://discuss.elastic.co/u/shankarbala)\
**Post date:** [October 17, 2016, 11:41pm UTC](https://discuss.elastic.co/t/modify-logstash-conf-through-script/63235/1 "2016-10-17T23:41:13Z")

</div>

hi

we have logstash 2.4.0 running..i know that it can reload whenever the config file changes automatically..  
but i wanted to know how to modify the logstash conf file using a script because i wanna do this in automated way

i have logstash conf like below

output {  
if [Y] in ["a", "b","c"]  
stdout { codec =\> rubydebug }  
elasticsearch {  
hosts =\> ["elhost:9200"]  
...  
...  
}

Y value is coming from filter function which i didnt mention here.  
Y value changes everyday..like if new customers are added., then it will have [a,b,c,d].,

i wanna know how can i add "d" in logstash output so it can send the data of new customers to elasticsearch automatically

shan

---

<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:** [October 18, 2016, 5:57am UTC](https://discuss.elastic.co/t/modify-logstash-conf-through-script/63235/2 "2016-10-18T05:57:32Z")

</div>

Instead of regenerating configuration files, perhaps you should use the translate filter to look up the `Y` field against a table of customers?

How to generate a textfile using a script seems like a generic programming question that's perhaps better asked at e.g. Stackoverflow.

---

<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:33am UTC](https://discuss.elastic.co/t/modify-logstash-conf-through-script/63235/3 "2017-07-06T04:33:51Z")

</div>


