# Passing environment variable from init script to log4j2

**URL:** <https://discuss.elastic.co/t/passing-environment-variable-from-init-script-to-log4j2/89126>\
**Category:** Logstash\
**Created:** [June 13, 2017, 12:57am UTC](https://discuss.elastic.co/t/passing-environment-variable-from-init-script-to-log4j2/89126 "2017-06-13T00:57:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)\
**Post date:** [June 13, 2017, 12:57am UTC](https://discuss.elastic.co/t/passing-environment-variable-from-init-script-to-log4j2/89126/1 "2017-06-13T00:57:05Z")

</div>

Hello,

I am running logstash-5.4.1.

I am running multiple instances using --path.data option  
But logs from these instances go to logstash-plain.log

At the moment I have export LS\_OPTS="-DInstance\_Name=${2}"$LS\_OPTS

And in log4j2 file I have ${sys:Instance\_Name}

what is created instead is ${sys:Instance\_Name}-plain.log

---

<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 11, 2017, 12:57am UTC](https://discuss.elastic.co/t/passing-environment-variable-from-init-script-to-log4j2/89126/2 "2017-07-11T00:57:16Z")

</div>

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