Streaming CloudWatch Logs to Amazon OpenSearch Service via Command Line
To stream CloudWatch Logs data to Amazon OpenSearch Service using the command line, follow these steps:
-
Ensure you have created a domain in Amazon OpenSearch Service to store the CloudWatch Logs data.
-
Install and configure the AWS CLI (Command Line Interface) tool on your local machine.
-
Open a terminal or command prompt and run the following command to create a CloudWatch Logs subscription filter to OpenSearch Service:
aws logs put-subscription-filter --log-group-name <log-group-name> --filter-name <filter-name> --filter-pattern "" --destination-arn <destination-arn> --role-arn <role-arn>
Where:
- <log-group-name> is the name of the CloudWatch Logs log group to subscribe to.
- <filter-name> is the name of the subscription filter, which can be customized.
- <destination-arn> is the ARN (Amazon Resource Name) of the Amazon OpenSearch Service domain.
- <role-arn> is the ARN of the IAM role with permissions to access CloudWatch Logs.
- Once you run this command, CloudWatch Logs will start streaming data to the OpenSearch Service domain.
Note that it may take some time for the changes to take effect after running this command, and CloudWatch Logs data will be filtered and streamed based on the pattern you specified in the subscription filter.
原文地址: https://www.cveoy.top/t/topic/puI7 著作权归作者所有。请勿转载和采集!