amazon-web-services - 使用 logstash 将数据流式传输到 amazon elasticsearch?

标签 amazon-web-services elasticsearch logstash amazon-elasticsearch

所以我启动了一个 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/

相关文章:

django - 在 Amazon Elastic Beanstalk 上使用 Docker 部署 Django

deployment - 启动 Elastic Beanstalk 环境时出错

elasticsearch - 按字段排序的前100个文档的汇总

powershell - 没有手动换行符,Logstash无法解析json数据

elasticsearch - Logstash中的CSV过滤器引发 “_csvparsefailure”错误

node.js - AWS Api Gateway : How to handle authorization, 身份验证、SSO 等

android - 使用 AWS 的典型应用程序用户身份验证

.net - ElasticSearch.net 6.0.2:无法声明PostData或Index方法

elasticsearch - 从json中的kibana提取我的索引模式?

mongodb - 使用ELK堆栈将用户信息添加到集中式日志记录中