logstash logstash-2.4 - 配置错误无法启动

时间:2016-10-16 03:04:43

标签: logstash-configuration

我是logstash的新手。我希望你能解决我的问题。非常感谢!

我安装了logstash 2.4。我运行了logstash --configtest -f logstash.conf显示没有错误;每次我开始使用logstash时,它都会持续大约30秒,然后它会自动关闭。日志有以下错误。这是我的logstash.conf

------- logstash.conf -------

input {
        redis {
                host => "elk.mydomain.com"
                type => "redis"
                data_type => "list"
                key => "logstash"
        }
}

filter {
  if [path] =~ "access" {
    mutate { replace => { "type" => "apache_access" } }
    grok {
      match => { "message" => "%{COMBINEDAPACHELOG}" }
    }
  }
  date {
    match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
  }
}

output {
  elasticsearch {
    hosts => ["localhost:9200"]
  }
  stdout { codec => rubydebug }
}


----------- logstash.log -----------
{:timestamp=>"2016-10-16T02:23:27.637000+0000", :message=>"Pipeline aborted `due to error", :exception=>"LogStash::ConfigurationError", :backtrace=>["/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/config/mixin.rb:88:in `config_init'", "org/jruby/RubyHash.java:1342:in `each'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/config/mixin.rb:72:in `config_init'",` "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/outputs/base.rb:79:in `initialize'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/output_delegator.rb:74:in `register'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:181:in `start_workers'", "org/jruby/RubyArray.java:1613:in `each'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:181:in `start_workers'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/pipeline.rb:136:in `run'", "/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.4.0-java/lib/logstash/agent.rb:491:in `start_pipeline'"], :level=>:error}
{:timestamp=>"2016-10-16T02:23:30.645000+0000", :message=>"stopping pipeline", :id=>"main"}
--------

菲利普

1 个答案:

答案 0 :(得分:0)

我解决了自己的问题。毕竟这是语法错误。下面这一行引起了问题。

match => { "message" => "%{COMBINEDAPACHELOG}" }

我用[]

替换了{}
match => [ "message" => "%{COMBINEDAPACHELOG}" ]

菲利普