本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
搭配 Fluentd OpenSearch 使用擷取管道
Fluentd 是開放原始碼資料收集生態系統,SDKs提供 Fluent Bit 等不同語言和子專案。此範例 Fluentd 組態檔案
注意下列事項:
-
endpoint
值必須是您的管道端點。例如:
。pipeline-endpoint
.us-east-1.osis.amazonaws.com/apache-log-pipeline/logs -
aws_service
值必須為osis
。 -
此
aws_role_arn
值是用戶端擔任和用於 Signature 第 AWS IAM4 版身分驗證ARN的角色。
<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_regionus-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