将 OpenSearch 采集管道与 Fluentd 配合使用 - 亚马逊 OpenSearch 服务
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

将 OpenSearch 采集管道与 Fluentd 配合使用

Fluentd 是一个开源数据收集生态系统,它为不同的语言和子项目(如 Fluent Bit)提供软件开发工具包。此示例 Fluentd 配置文件将日志数据从 Fluentd 发送到摄取管道。 OpenSearch 有关摄取日志数据的更多信息,请参阅 Data Prepper 文档中的日志分析

请注意以下几点:

  • endpoint 值必须是管道端点。例如,pipeline-endpoint.us-east-1.osis.amazonaws.com/apache-log-pipeline/logs

  • aws_service 值必须为 osis

  • aws_role_arn值是 Amazon IAM 角色的 ARN,供客户端代入并用于签名版本 4 身份验证。

<source> @type tail path logs/sample.log path_key log tag apache <parse> @type none </parse> </source> <filter apache> @type record_transformer <record> log ${record["message"]} </record> </filter> <filter apache> @type record_transformer remove_keys message </filter> <match apache> @type http endpoint pipeline-endpoint.us-east-1.osis.amazonaws.com/apache-log-pipeline/logs json_array true <auth> method aws_sigv4 aws_service osis aws_region us-east-1 aws_role_arn arn:aws:iam::{account-id}:role/ingestion-role </auth> <format> @type json </format> <buffer> flush_interval 1s </buffer> </match>

然后,您可以配置如下所示的 OpenSearch 采集管道,该管道以 HTTP 为源:

version: "2" apache-log-pipeline: source: http: path: "/${pipelineName}/logs" processor: - grok: match: log: - "%{TIMESTAMP_ISO8601:timestamp} %{NOTSPACE:network_node} %{NOTSPACE:network_host} %{IPORHOST:source_ip}:%{NUMBER:source_port:int} -> %{IPORHOST:destination_ip}:%{NUMBER:destination_port:int} %{GREEDYDATA:details}" sink: - opensearch: hosts: ["https://search-domain-endpoint.us-east-1.es.amazonaws.com"] index: "index_name" aws_sts_role_arn: "arn:aws:iam::{account-id}:role/pipeline-role" aws_region: "us-east-1" aws_sigv4: true