所以我启动了一个 2 实例 Amazon Elasticsearch 集群。
我已经安装了 logstash-output-amazon_es插入。这是我的 logstash 配置文件:
input {
file {
path => "/Users/user/Desktop/user/logs/*"
}
}
filter {
grok {
match => {
"message" => '%{COMMONAPACHELOG} %{QS}%{QS}'
}
}
date {
match => [ "timestamp", "dd/MMM/YYYY:HH:mm:ss Z" ]
locale => en
}
useragent {
source => "agent"
target => "useragent"
}
}
output {
amazon_es {
hosts => ["foo.us-east-1.es.amazonaws.com"]
region => "us-east-1"
index => "apache_elk_example"
template => "./apache_template.json"
template_name => "apache_elk_example"
template_overwrite => true
}
}
现在我从我的终端运行它:
/usr/local/opt/logstash/bin/logstash -f apache_logstash.conf
我得到错误:
Failed to install template: undefined method `credentials' for nil:NilClass {:level=>:error}
我想我完全错了。基本上我只想通过 logstash 将一些虚拟日志输入提供给我的 amazon elasticsearch 集群。我应该如何进行?
编辑存储类型为实例,访问策略设置为所有人都可以访问。
编辑
output {
elasticsearch {
hosts => ["foo.us-east-1.es.amazonaws.com"]
ssl => true
index => "apache_elk_example"
template => "./apache_template.json"
template_name => "apache_elk_example"
template_overwrite => true
}
}
最佳答案
我也遇到了同样的问题,我通过在主机名后面提到端口来解决它。
发生这种情况是因为主机名 hosts => ["foo.us-east-1.es.amazonaws.com"]
指向 foo.us-east-1.es.amazonaws.com: 9200
这不是 aws elasticsearch 的默认端口。因此,通过将主机名更改为 foo.us-east-1.es.amazonaws.com:80
可以解决问题。
关于amazon-web-services - 使用 logstash 将数据流式传输到 amazon elasticsearch?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37785492/