Logstash environment variables missing

I have the following environment vars

ansible@sv5enalysis01:~$ printenv  | grep REDIS
REDIS_HOST=172.16.4.35
REDIS_PORT=6381
ansible@sv5enalysis01:~$

but when I start logstash it doesn't replace them

ansible@sv5enalysis01:~$ /opt/logstash/bin/logstash --allow-env -f /etc/logstash/redis.conf
Settings: Default pipeline workers: 32
Could not connect to Redis at %{REDIS_HOST}:0: Name or service not known
Could not connect to Redis at %{REDIS_HOST}:0: Name or service not known
Could not connect to Redis at %{REDIS_HOST}:0: Name or service not known
Could not connect to Redis at %{REDIS_HOST}:0: Name or service not known
Could not connect to Redis at %{REDIS_HOST}:0: Name or service not known

this is what my config looks like

input {
   exec {
      command => 'redis-cli -h 172.16.4.35 -p 6381 info clients'
      interval => 60
      type => "clients"
   }

   exec {
      command => "redis-cli -h %{REDIS_HOST} -p %{REDIS_PORT} info memory"
      interval => 60
      type => "memory"
   }

   exec {
      command => "redis-cli -h %{REDIS_HOST} -p %{REDIS_PORT} info cpu"
      interval => 60
      type => "cpu"
    }

    exec {
      command => "redis-cli -h %{REDIS_HOST} -p %{REDIS_PORT} info stats"
      interval => 60
      type => "stats"
    }

    exec {
      command => "redis-cli -h %{REDIS_HOST} -p %{REDIS_PORT} info replication"
      interval => 60
      type => "replication"
    }

    exec {
      command => "redis-cli -h %{REDIS_HOST} -p %{REDIS_PORT} info keyspace"
      interval => 60
      type => "keyspace"
    }

}
filter {
    environment {
      add_metadata_from_env => {'redis_host' => "REDIS_HOST"}
    }
    split {
    }
    ruby {
       code => "fields = event['message'].split(':')
       if (fields[0] == 'db0')
          fields[1].split(',').each { |t| terms = t.split('='); event[terms[0]] = terms[1].to_i }
       else
          event[fields[0]] = fields[1].to_f
       end
       event['port'] = ENV['REDIS_PORT']
       event['rhost'] = ENV['REDIS_HOST']
       event['hostport'] = ENV['REDIS_HOST']+ENV['REDIS_PORT']
       "
    }
    mutate {
        remove_field => [ "command", "host" ]
    }

}

output {
    elasticsearch {
       hosts => ["192.168.0.243:9201", "192.168.0.252:9201", "192.168.0.254:9201", "192.168.0.255:9201"]
       index => 'redis_cluster-sv5-%{+YYYY.MM.dd}'
       idle_flush_time => 1
       timeout => 10
       workers => 1
    }
    stdout { codec => rubydebug { metadata => true } }
}

Use ${REDIS_HOST}, not %{REDIS_HOST}.

https://www.elastic.co/guide/en/logstash/current/environment-variables.html

awesome that totally fixed it! thanks! I should have seen that.