# Cannot access logstash environmental variables

**URL:** <https://discuss.elastic.co/t/cannot-access-logstash-environmental-variables/151294>\
**Category:** Logstash\
**Created:** [October 6, 2018, 5:42am UTC](https://discuss.elastic.co/t/cannot-access-logstash-environmental-variables/151294 "2018-10-06T05:42:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)\
**Post date:** [October 6, 2018, 5:42am UTC](https://discuss.elastic.co/t/cannot-access-logstash-environmental-variables/151294/1 "2018-10-06T05:42:44Z")

</div>

I installed logstash via Docker and I keep getting the error when I am trying to access an environmental variable locally on the machine. I've tried adding it in /etc/environment and /etc/default/logstash both getting the same error. Any idea where to store this variable on the docker installation?

I'm using the variable in an input in logstash called `${Timestamp}`

> Failed to execute action {:action=\>LogStash::PipelineAction::Create/pipeline\_id:main, :exception=\>"LogStash::ConfigurationError", :message=\>"Cannot evaluate `${Timestamp}`. Replacement variable `Timestamp` is not defined in a Logstash secret store or as an Environment entry and there is no default value given.", :backtrace=\>["/usr/share/logstash/logstash-core/lib/logstash/util/substitution\_variables.rb:50:in `block in replace_placeholders'", "org/jruby/RubyString.java:2541:in `gsub'", "/usr/share/logstash/logstash-core/lib/logstash/util/substitution\_variables.rb:35:in `replace_placeholders'", "/usr/share/logstash/logstash-core/lib/logstash/util/substitution_variables.rb:23:in `deep\_replace'", "/usr/share/logstash/logstash-core/lib/logstash/config/mixin.rb:82:in `block in config_init'", "org/jruby/RubyHash.java:1343:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/config/mixin.rb:81:in `config_init'", "/usr/share/logstash/logstash-core/lib/logstash/inputs/base.rb:60:in `initialize'", "org/logstash/plugins/PluginFactoryExt.java:233:in `plugin'", "org/logstash/plugins/PluginFactoryExt.java:166:in `plugin'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:71:in `plugin'", "(eval):8:in `'", "org/jruby/RubyKernel.java:994:in `eval'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:49:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:90:in `initialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:38:in `execute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:309:in `block in converge\_state'"]}

---

<div class="post-metadata">

**Author:** ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)\
**Post date:** [October 6, 2018, 11:28pm UTC](https://discuss.elastic.co/t/cannot-access-logstash-environmental-variables/151294/2 "2018-10-06T23:28:30Z")

</div>

What I'm trying to do in the end is I have a node script that finds the most recent Timestamp in my SQL db so then I can import only new ES documents to that SQL db. Once the node script runs, it needs to save that timestamp locally for LS to access to use as a filter.

---

<div class="post-metadata">

**Author:** ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)\
**Post date:** [October 7, 2018, 5:32am UTC](https://discuss.elastic.co/t/cannot-access-logstash-environmental-variables/151294/3 "2018-10-07T05:32:37Z")

</div>

When I ran logstash as `sudo -u root /usr/share/logstash/bin/logstash` then it could access /etc/environment folder with the timestamp in there. Problem solved.

---

<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:** [November 4, 2018, 5:32am UTC](https://discuss.elastic.co/t/cannot-access-logstash-environmental-variables/151294/4 "2018-11-04T05:32:48Z")

</div>

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