dead_letter_queue {
path => "/usr/share/logstash/data/dead_letter_queue/"
pipeline_id => "main"
commit_offsets => true
}
Trying to do stdout { codec => rubycodec { metadata => true } fails logstash from starting:
│ logstash [2020-02-27T12:35:48,091][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [A-Za-z0-9_-], [ \t\r\ │
│ \n], "#", "{", [A-Za-z0-9_], "}" at line 3, column 23 (byte 44) after output {\n stdout { \n codec => rubydebug", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:47:incompile_imperative'", "/usr/share/logstash/log │ │ stash-core/lib/logstash/compiler.rb:55:in
compile_graph'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:17:inblock in compile_sources'", "org/jruby/RubyArray.java:2580:in
map'", "/usr/share/logstash/logstash-core/lib/logstash/compi │
│ ler.rb:14:incompile_sources'", "org/logstash/execution/AbstractPipelineExt.java:161:in
initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:ininitialize'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:27:in
init │
│ ialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:36:inexecute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:326:in
block in converge_state'"]}
│ logstash [2020-02-27T12:35:49,419][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of [A-Za-z0-9_-], [ \t\r\ │
│ \n], "#", "{", [A-Za-z0-9_], "}" at line 3, column 23 (byte 44) after output {\n stdout { \n codec => rubydebug", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:47:incompile_imperative'", "/usr/share/logstash/log │ │ stash-core/lib/logstash/compiler.rb:55:in
compile_graph'", "/usr/share/logstash/logstash-core/lib/logstash/compiler.rb:17:inblock in compile_sources'", "org/jruby/RubyArray.java:2580:in
map'", "/usr/share/logstash/logstash-core/lib/logstash/compi │
│ ler.rb:14:incompile_sources'", "org/logstash/execution/AbstractPipelineExt.java:161:in
initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:ininitialize'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:27:in
init │
│ ialize'", "/usr/share/logstash/logstash-core/lib/logstash/pipeline_action/create.rb:36:inexecute'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:326:in
block in converge_state'"]}
While stdout { codec => rubydebug } without the metadata part works flawlessly (but doesnt show metadata)
Mutating the field into a var
mutate {
add_field => { "reason" => "%{[@metadata][dead_letter_queue][reason]}" }
}
gives this field:
"reason":"%{[@metadata][dead_letter_queue][reason]}"