使用 boto3 查询 AWS Cloudwatch 日志组订阅

Querying AWS Cloudwatch Log Group Subscriptions Using boto3

在 AWS CloudWatch 中可以添加 Subscriptions to a Log group 以便组内的日志可以流向 Kinesis、Firehose 等。可以在控制台中查看这些订阅:

如何使用 boto3 查询 'Subscriptions' 值?

我试过以下方法

import boto3
client = boto3.client('logs', region_name='us-east-1')
client.describe_log_groups()

但只有returns以下属性(注意:具体值已被删节):

{'logGroups': [{'logGroupName': '<myGroupNameValue>',   
   'creationTime': <myCreationTimeValue>,    'metricFilterCount': 0,
   'arn': '<myArnValue>', 
   'storedBytes': <myStoredBytesValue>},
   ...]}

返回的 json 不包含 'subscriptions' key/value 对。

提前感谢您的考虑和回复

有一个describe_subscription_filtersAPI。 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/logs.html#CloudWatchLogs.Client.describe_subscription_filters

对你有帮助吗?