0

我的编程语言是 C#。我已经在我的电脑上部署了 ELK 和 rabbitmq。现在我想使用 Logstash 连接到 RabbitMQ 来使用 RabbitMQ 消息。但是当我启动 logstash 时它不起作用,并给我一些这样的错误:

PS D:\ELK\logstash-5.6.4\bin> .\logstash -f logstash.conf
Sending Logstash's logs to D:/ELK/logstash-5.6.4/logs which is now configured via log4j2.properties
[2019-07-05T17:17:21,042][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"fb_apache", :directory=>"D:/ELK/logstash-5.6.4/modules/fb_apache/configuration"}
[2019-07-05T17:17:21,047][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"netflow", :directory=>"D:/ELK/logstash-5.6.4/modules/netflow/configuration"}`enter code here`
[2019-07-05T17:17:22,159][INFO ][logstash.outputs.elasticsearch] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://127.0.0.1:9200/]}}
[2019-07-05T17:17:22,160][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://127.0.0.1:9200/, :path=>"/"}
[2019-07-05T17:17:22,251][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>"http://127.0.0.1:9200/"}
[2019-07-05T17:17:22,285][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>nil}
[2019-07-05T17:17:22,288][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=>{"template"=>"logstash-*", "version"=>50001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"_default_"=>{"_all"=>{"enabled"=>true, "norms"=>false}, "dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date", "include_in_all"=>false}, "@version"=>{"type"=>"keyword", "include_in_all"=>false}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}}
[2019-07-05T17:17:22,296][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["//127.0.0.1:9200"]}
[2019-07-05T17:17:22,300][INFO ][logstash.pipeline        ] Starting pipeline {"id"=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>500}
[2019-07-05T17:17:22,315][INFO ][logstash.pipeline        ] Pipeline main started
The stdin plugin is now waiting for input:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/ELK/logstash-5.6.4/logstash-core/lib/org/apache/logging/log4j/log4j-slf4j-impl/2.6.2/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/ELK/logstash-5.6.4/vendor/bundle/jruby/1.9/gems/march_hare-3.0.0-java/lib/ext/slf4j-simple.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
[2019-07-05T17:17:22,414][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2019-07-05T17:17:22,415][INFO ][logstash.inputs.rabbitmq ] Connected to RabbitMQ at
[2019-07-05T17:17:22,416][WARN ][logstash.inputs.rabbitmq ] Error while setting up connection for rabbitmq input! Will retry. {:message=>"no method 'queueDeclare' for arguments (org.jruby.RubyString,org.jruby.RubyBoolean.False,org.jruby.RubyBoolean.False,org.jruby.RubyBoolean.False,org.jruby.RubyArray) on Java::ComRabbitmqClientImpl::ChannelN\n  available overloads:\n    (java.lang.String,boolean,boolean,boolean,java.util.Map)\n    (java.lang.String,boolean,boolean,boolean,java.util.Map)", :class=>"NameError", :location=>"D:/ELK/logstash-5.6.4/vendor/bundle/jruby/1.9/gems/march_hare-3.0.0-java/lib/march_hare/channel.rb:500:in `queue_declare'"}
[2019-07-05T17:17:23,418][WARN ][logstash.inputs.rabbitmq ] Error while setting up connection for rabbitmq input! Will retry. {:message=>"no method 'queueDeclare' for arguments (org.jruby.RubyString,org.jruby.RubyBoolean.False,org.jruby.RubyBoolean.False,org.jruby.RubyBoolean.False,org.jruby.RubyArray) on Java::ComRabbitmqClientImpl::ChannelN\n  available overloads:\n    (java.lang.String,boolean,boolean,boolean,java.util.Map)\n    (java.lang.String,boolean,boolean,boolean,java.util.Map)", :class=>"NameError", :location=>"D:/ELK/logstash-5.6.4/vendor/bundle/jruby/1.9/gems/march_hare-3.0.0-java/lib/march_hare/channel.rb:500:in `queue_declare'"}

我无法理解这些错误。而且rabbitmq 消息始终处于就绪状态,没有人确认。据我所知,它一定是一些配置错误。我试图改变我的logstash配置,但它仍然没有效果。我的 LogStash 配置喜欢这样:

input{
    stdin{}
    rabbitmq{
        host => "192.168.88.204"
        port => 5672
        user => "admin"
        password => "123456"
        queue => "Poly_Log"
        durable => false
        auto_delete => false        
        exchange => "Poly_Log"
        exchange_type => "direct"
        key => "Poly_Log"
        prefetch_count  => 256
        ack => true
        exclusive => false
        heartbeat => 20
        arguments => [{ "x-message-ttl" => 120000 }, { "x-max-length-bytes" => 314572800 }]
    }
}
filter{
}
output{
    stdout{
        codec => rubydebug
    }
    elasticsearch{
        hosts => ["127.0.0.1:9200"]
        index => "logstash-log-%{+YYYY.MM.dd}"
    }
    file{
        path => "/tmp/logstash-log-%{+YYYY.MM.dd}"
    }
}

请帮我解决这个问题。我将不胜感激。

4

0 回答 0