How to read environment variables from logstash?

(Punit Naik) #1

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

add_metadata_from_env => {"hadoop" => "HADOOP_HOME"}

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!

(Magnus B├Ąck) #2

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

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

(Punit Naik) #3

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

(system) #4