加载中

Elastic Agent 到 Logstash 以路由到多个 Elasticsearch 集群及其他目标

Image showing Elastic Agent collecting and routing data to multiple destinations
摄取模型
Elastic Agent 到 Logstash,再到 Elasticsearch 集群及其他目标
适用情况
Elastic Agent 收集的数据需要根据内容路由到不同的 Elasticsearch 集群或非 Elasticsearch 目标
示例

我们以一台 Windows 工作站为例,我们使用 System 和 Windows 集成来收集不同类型的日志。这些日志需要发送到不同的 Elasticsearch 集群以及 S3 进行备份,并需要一种机制将其发送到其他目标,例如不同的 SIEM 解决方案。此外,Elasticsearch 的目标是根据数据流的类型和组织标识符来派生的。

在此类用例中,代理将数据发送到 Logstash,作为路由机制发送到不同目标。System 和 Windows 集成必须安装在数据路由到的所有 Elasticsearch 集群上。

input {
  elastic_agent {
    port => 5044
  }
}
filter {
  translate {
    source => "[http][host]"
    target => "[@metadata][tenant]"
    dictionary_path => "/etc/conf.d/logstash/tenants.yml"
  }
}
output {
  if [@metadata][tenant] == "tenant01" {
    elasticsearch {
      hosts => "ELASTICSEARCH_ENDPOINT_URL"
      api_key => "<api key>"
    }
  } else if [@metadata][tenant] == "tenant02" {
    elasticsearch {
      cloud_id => "<cloud id>"
      api_key => "<api key>"
    }
  }
}
		
  1. 使用 hosts 选项配合 Elasticsearch 端点 URL 将数据发送到 Elasticsearch Serverless
  2. 使用 cloud_id 将数据发送到 Elastic Cloud Hosted

关于配置 Elastic Agent 的信息

关于 Logstash 和 Logstash 输出的信息

关于 Elasticsearch 的信息

© . This website operates independently and is not affiliated with or endorsed by Elasticsearch B.V. All brand names, logos, and trademarks are the property of their respective owners.