I am consistently getting an error with trying to pick up the environment variable within my input config file.
Here is what I have:
input {
redis {
data_type => "list"
key => "syslog"
host => "${REDIS_HOST}"
add_field => { "logstash_host" => '${HOSTNAME}'
"log_source" => "redis"
"msg_src" => "%{[type]}" }
tags => [ "syslog", "redis" ]
}
}
It isn't picking up the REDIST_HOST or the HOSTNAME variables. I have added them to the /etc/default/logstash
file (this is Ubuntu 16.04). I have even tried doing it via a shell script inside of /etc/profile.d
I have tried with both export REDIS="10.2.2.2"
and just REDIS="10.2.2.2"
and neither is working.
The error I get is the following:
[2018-02-07T15:19:49,562][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Cannot evaluate
${REDIS_HOST}
. Environment variableREDIS_HOST
is not set and there is no default value given.", :backtrace...
I start via a service (sudo service logstash start
). What am I doing wrong?