Hi There,
I need some help in testing this. Below is the logstash config file[logstash-6.5.4/config/logstash-sample-4.conf]. I would like to feed the logstash with elasticsearch logs, which runs on port 9200.
input {
tcp {
type => "logs"
codec => "json"
port => 9200
}
file {
path => "/var/log/system.log"
type => "syslog"
}
}
output {
if [type]=="syslog" {
elasticsearch {
hosts => [ "localhost:9200" ]
index => "syslog-debug-%{+YYYY.MM.dd}"
}
}
else if [type]=="logs" {
elasticsearch {
hosts => [ "localhost:9200" ]
index => "elasticlogs-debug-%{+YYYY.MM.dd}"
stdout {
codec => rubydebug
}
}
}
else {
elasticsearch {
hosts => [ "localhost:9200" ]
index => "logs-debug-%{+YYYY.MM.dd}"
}
}
}
Ran logstash with logstash -f <logstash_file>
But it is failing.
[2019-04-02T13:23:07,899][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, => at line 25, column 15 (byte 493) after output {\n if [type]==\"syslog\" {\n elasticsearch {\n hosts => [ \"localhost:9200\" ]\n index => \"syslog-debug-%{+YYYY.MM.dd}\"\n }\n } \n else if [type]==\"logs\" {\n elasticsearch {\n hosts => [ \"localhost:9200\" ]\n index => \"elasticlogs-debug-%{+YYYY.MM.dd}\"\n stdout ", :backtrace=>["/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/compiler.rb:41:in `compile_imperative'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/compiler.rb:49:in `compile_graph'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/compiler.rb:11:in `block in compile_sources'", "org/jruby/RubyArray.java:2486:in `map'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/compiler.rb:10:in `compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:149:in `initialize'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/pipeline.rb:22:in `initialize'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/pipeline.rb:90:in `initialize'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/pipeline_action/create.rb:42:in `block in execute'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/agent.rb:92:in `block in exclusive'", "org/jruby/ext/thread/Mutex.java:148:in `synchronize'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/agent.rb:92:in `exclusive'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/pipeline_action/create.rb:38:in `execute'", "/Users/mouliveera/Desktop/tools/logstash-6.5.4/logstash-core/lib/logstash/agent.rb:317:in `block in converge_state'"]}
I tried with apache port 80 as well. I see the similar behaviour. Can someone help me in fixing it.
Thanks