Closed
Description
Logstash information:
Please include the following information:
- Logstash version (e.g.
bin/logstash --version
)
8.16.0
- Logstash installation source (e.g. built from source, with a package manager: DEB/RPM, expanded from tar or zip archive, docker)
Built from source
Description of the problem including expected versus actual behavior:
When using an environment variable to populate the list of elasticsearch hosts in a pipeline configured in pipelines.yml
, the pipeline fails to start.
Note that the same pipeline definition works successfully when supplied using -f
or -e
Steps to reproduce:
- Set an environment variable with an elasticsearch host in it - eg
export PRODUCTION_ES_HOSTS="https://test-es-es-http.e2e-mercury.svc:9200"
- Add a pipeline in
pipelines.yml
that refers to this variable:
- pipeline.id: test
config.string: 'input { exec { command => "uptime" interval => 10 } } output { elasticsearch {hosts => "${PRODUCTION_ES_HOSTS}"}}'
- Run
bin/logstash
Provide logs (if relevant):
The pipeline will fail, with the following error:
[2024-08-09T12:30:36,236][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:test, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [A-Za-z0-9_-], [ \\t\\r\\n], \"#\", \"{\", [A-Za-z0-9_], \"}\" at line 1, column 91 (byte 91) after output { elasticsearch {hosts => https", :backtrace=>["/Users/robbavey/code/logstash/logstash-core/lib/logstash/compiler.rb:32:in `compile_imperative'", "org/logstash/execution/AbstractPipelineExt.java:239:in `initialize'", "org/logstash/execution/AbstractPipelineExt.java:173:in `initialize'", "/Users/robbavey/code/logstash/logstash-core/lib/logstash/java_pipeline.rb:48:in `initialize'", "org/jruby/RubyClass.java:949:in `new'", "/Users/robbavey/code/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:49:in `execute'", "/Users/robbavey/code/logstash/logstash-core/lib/logstash/agent.rb:386:in `block in converge_state'"]}