Modify logstash conf through script


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 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


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.