Using Windows ENV variables in Logstash

I have set an environment variable in windows using Powershell with following command:
$env:MW_Index = 'mw-test-index'

In my logstash.config file, I am trying to use this variable in the following way:
mutate { add_field => { "[@metadata][target_index]" => ${MW_INDEX} } }

Right at the point where I am calling this variable ($ sign), I am getting this error while running Logstash:
:exception=>"LogStash::ConfigurationError", :message=>"Expected one of [ \\t\\r\\n], \"#\", [A-Za-z0-9_-], '\"', \"'\", [A-Za-z_], \"-\", [0-9], \"[\", \"{\" at line 29, column 60 (byte 1092)

Hi,

I think you need to put it into double quotes.

mutate { 
  add_field => { 
    "[@metadata][target_index]" => "${MW_INDEX}" 
  }
}

Cad.

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