我无法将日志从 Logstash 发送到 Redis 服务器。出现此错误:
Failed to send event to redis {:event=>#<LogStash::Event:0x7ccb7867 @cancelled=false, @data={"message"=>"welocwelcome", "@timestamp"=>"2014-07-07T21:00:34.583Z", "@version"=>"1", "host"=>"localhost.localdomain"}>, :identity=>"default", :exception=>#<Errno::EHOSTUNREACH: No route to host - SocketChannel.connect>, :backtrace=>["org/jruby/ext/socket/RubyTCPSocket.java:123:in `initialize'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/connection/ruby.rb:13:in `initialize'", "org/jruby/RubyIO.java:855:in `new'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/connection/ruby.rb:74:in `connect'", "org/jruby/ext/timeout/Timeout.java:127:in `timeout'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/connection/ruby.rb:73:in `connect'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/connection/ruby.rb:180:in `connect'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/client.rb:273:in `establish_connection'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/client.rb:69:in `connect'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/client.rb:292:in `ensure_connected'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/client.rb:179:in `process'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/client.rb:258:in `logging'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/client.rb:178:in `process'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis/client.rb:84:in `call'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis.rb:972:in `rpush'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis.rb:36:in `synchronize'", "jar:file:/opt/logstash/logstash-1.2.2-flatjar.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'", "jar:file:/opt/logstash/logstash-1.2.2-flatjar.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:210:in `mon_synchronize'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis.rb:36:in `synchronize'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/redis.rb:971:in `rpush'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/logstash/outputs/redis.rb:162:in `receive'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/logstash/outputs/base.rb:85:in `handle'", "(eval):21:in `initialize'", "org/jruby/RubyProc.java:271:in `call'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/logstash/pipeline.rb:254:in `output'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/logstash/pipeline.rb:213:in `outputworker'", "file:/opt/logstash/logstash-1.2.2-flatjar.jar!/logstash/pipeline.rb:140:in `start_outputs'"], :level=>:warn}
这是我的logstash 配置文件的内容:
input { stdin { } }
output {
stdout { codec => rubydebug }
redis { host => "192.168.209.129" data_type => "list" key => "logstash" }
}
答案1
我重新启动了 Redis 和 Logstash,之后一切突然开始工作了。经验教训:永远不要低估重新启动的力量!