How to read environment variables from logstash?

I wanted to read an environment variable so I used the environment filter.
This was my config:

input
{stdin{}}
filter{
environment{
add_metadata_from_env => {"hadoop" => "HADOOP_HOME"}
}
}
output{stdout{codec=>rubydebug}}

where "HADOOP_HOME" is my environment variable.
The output however did not show the extra field "hadoop" and its not giving me any errors too.

So what is wrong? Please help!

The rubydebug codec needs to be configured to include the contents of the @metadata field:

output {
  stdout {
    codec => rubydebug {
      metadata => true
    }
  }
}

Thank you so much Mr. @magnusbaeck! You rock! :sunglasses: :grin: