Exporting environment variables from startup.options doesn't work

Hi,

I'm trying to implement the following solution using chef, in which the startup.options file looks as follows:

...
read -r -d '' PRESTART << EOM
 export A=1
 export B=2
 export C=3
EOM
...

Then, I'm starting the logstash service through chef's service (which is probably systemctl, as I'm running CentOS 7.0) with the logstash.yml file referring to the correct logstash.conf file in another folder.

However, the environment variables I export on the PRESTART part of the startup.options doesn't seem to be exported well, as I get an error in the log saying:

Cannot create pipeline {:reason=>"Cannot evaluate${MY_ENV_VAR}. Environment variableMY_ENV_VARis not set and there is no default value given."}

Any idea what might be the cause for the environment variables not available to logstash even though they are exported in its own startup.options file?

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