我觉得我错过了一些东西,因为Interweb上似乎没有人有任何问题。我安装了Windows Server 2008 R2 EC2实例,IAM角色允许sqs:SendMessage
。我使用AWS CLI和命令aws sqs send-message
在命令行上成功地发送了一条消息。当我尝试使用Logstash-1.4.2时,我得到以下错误:
Unable to access SQS queue 'Dev-ELK-LogstashBuffer': The specified queue does not exist or you do not have access to it. {:level=>:error}
Failed to flush outgoing items {:outgoing_count=>1, :exception=>#<NoMethodError: undefined method `batch_send' for nil:NilClass>, :backtrace=>
["C:/logstash/logstash-1.4.2/lib/logstash/outputs/sqs.rb:131:in `flush'",
"C:/logstash/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/stud-0.0.17/lib/stud/buffer.rb:219:in `buffer_flush'",
"org/jruby/RubyHash.java:1339:in `each'",
"C:/logstash/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/stud-0.0.17/lib/stud/buffer.rb:216:in `buffer_flush'",
"C:/logstash/logstash-1.4.2/vendor/bundle/jruby/1.9/gems/stud-0.0.17/lib/stud/buffer.rb:159:in `buffer_receive'",
"C:/logstash/logstash-1.4.2/lib/logstash/outputs/sqs.rb:123:in `receive'",
"C:/logstash/logstash-1.4.2/lib/logstash/outputs/base.rb:86:in `handle'",
"(eval):129:in `initialize'",
"org/jruby/RubyProc.java:271:in `call'",
"C:/logstash/logstash-1.4.2/lib/logstash/pipeline.rb:266:in `output'",
"C:/logstash/logstash-1.4.2/lib/logstash/pipeline.rb:225:in `outputworker'",
"C:/logstash/logstash-1.4.2/lib/logstash/pipeline.rb:152:in `start_outputs'"],
:level=>:warn}
以下是我对logstash的输出配置:
output {
sqs {
queue => "Dev-ELK-LogstashBuffer"
region => "us-west-2"
use_ssl => true
}
stdout { codec => rubydebug }
}
我可以直接使用弹性搜索输出,但尝试在我的服务器和弹性搜索集群之间添加消息队列缓冲区。
谢谢!
正确的IAM策略:
{
"Statement":[
{
"Resource": [
"arn:aws:sqs:us-west-2:1111111:Dev-ELK-LogstashBuffer"
],
"Action":[
"sqs:SendMessage",
"sqs:GetQueueAttributes",
"sqs:GetQueueUrl",
"sqs:ListQueues",
"sqs:ChangeMessageVisibility"
],
"Effect":"Allow"
}
],
"Version":"2012-10-17"
}