将 OpenSearch 采集管道与 Fluent Bit 配合使用 - 亚马逊 OpenSearch 服务

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

将 OpenSearch 采集管道与 Fluent Bit 配合使用

此示例 Fluent Bit 配置文件将日志数据从 Fluent Bit 发送到 OpenSearch 摄取管道。有关摄取日志数据的更多信息,请参阅 Data Prepper 文档中的日志分析

请注意以下几点:

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

  • aws_service 值必须为 osis

  • aws_role_arn值是客户端在ARN签名版本 4 身份验证中 AWS IAM扮演和使用的角色的值。

[INPUT] name tail refresh_interval 5 path /var/log/test.log read_from_head true [OUTPUT] Name http Match * Host pipeline-endpoint.us-east-1.osis.amazonaws.com Port 443 URI /log/ingest Format json aws_auth true aws_region us-east-1 aws_service osis aws_role_arn arn:aws:iam::{account-id}:role/ingestion-role Log_Level trace tls On

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

version: "2" unaggregated-log-pipeline: source: http: path: "/log/ingest" 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}" - grok: match: details: - "'%{NOTSPACE:http_method} %{NOTSPACE:http_uri}' %{NOTSPACE:protocol}" - "TLS%{NOTSPACE:tls_version} %{GREEDYDATA:encryption}" - "%{NUMBER:status_code:int} %{NUMBER:response_size:int}" - delete_entries: with_keys: ["details", "log"] sink: - opensearch: hosts: ["https://search-domain-endpoint.us-east-1.es.amazonaws.com"] index: "index_name" index_type: custom bulk_size: 20 aws: # IAM role that the pipeline assumes to access the domain sink sts_role_arn: "arn:aws:iam::{account-id}:role/pipeline-role" region: "us-east-1"