Hey everybody,
I have an error in my configuration-file.
I still think that the problem is the check if the value of [_source][machine_name] ist null, but i dont know why?!
Logstash configuration file
input {
http {
port => 31311
type => "log"
}
http {
port => 31312
type => "performance"
}
}
filter {
mutate {
remove_field => [ "headers" ]
}
}
output {
if [type] == "log"{
if [_source][MachineName] == null{
elasticsearch {
index => "log-%{+YYYY.MM.dd}"
}
}else{
elasticsearch{
index => "unbekannt-%{+YYYY.MM.dd}"
}
}
}else if [type] == "performance" {
if [_source][machine_name] == null{
elasticsearch{
index => "performance-%{+YYYY.MM.dd}"
}
}else{
elasticsearch{
index => "unbekannt-%{+YYYY.MM.dd}"
}
}
} else{
elasticsearch{
index => "unbekannt-%{+YYYY.MM.dd}"
}
}
}
Especially the output generates an error.
Here you can see the
Logstash error
[2018-04-12T11:41:07,278][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, ( at line 20, column 36 (byte 236) after output { \n\tif [type] == "log"{\n\t\tif [_source][MachineName] == null", :backtrace=>["C:/..MyPathTo../logstash/logstash-core/lib/logstash/compiler.rb:42:in compile_imperative'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/compiler.rb:50:in
compile_graph'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/compiler.rb:12:in block in compile_sources'", "org/jruby/RubyArray.java:2486:in
map'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/compiler.rb:11:in compile_sources'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/pipeline.rb:51:in
initialize'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/pipeline.rb:169:in initialize'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/pipeline_action/create.rb:40:in
execute'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/agent.rb:315:in block in converge_state'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/agent.rb:141:in
with_pipelines'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/agent.rb:312:in block in converge_state'", "org/jruby/RubyArray.java:1734:in
each'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/agent.rb:299:in converge_state'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/agent.rb:166:in
block in converge_state_and_update'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/agent.rb:141:in with_pipelines'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/agent.rb:164:in
converge_state_and_update'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/agent.rb:90:in execute'", "C:/..MyPathTo../logstash/logstash-core/lib/logstash/runner.rb:348:in
block in execute'", "C:/..MyPathTo../logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:24:in `block in initialize'"]}
I hope anyone can help me!
Thanks a lot,
PolterFox