Skip to content

list_aggregate_log_group_summaries

list_aggregate_log_group_summaries(
    group_by: ListAggregateLogGroupSummariesGroupBy,
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
    account_identifiers: Optional[AccountIds] = None,
    include_linked_accounts: Optional[IncludeLinkedAccounts] = None,
    log_group_class: Optional[LogGroupClass] = None,
    log_group_name_pattern: Optional[LogGroupNameRegexPattern] = None,
    data_sources: Optional[DataSourceFilters] = None,
    next_token: Optional[NextToken] = None,
    limit: Optional[ListLogGroupsRequestLimit] = None,
) -> ListAggregateLogGroupSummariesResponse

Returns an aggregate summary of all log groups in the Region grouped by specified data source characteristics. Supports optional filtering by log group class, name patterns, and data sources. If you perform this action in a monitoring account, you can also return aggregated summaries of log groups from source accounts that are linked to the monitoring account. For more information about using cross-account observability to set up monitoring accounts and source accounts, see CloudWatch cross-account observability.

The operation aggregates log groups by data source name and type and optionally format, providing counts of log groups that share these characteristics. The operation paginates results. By default, it returns up to 50 results and includes a token to retrieve more results.

Parameters:

  • account_identifiers (Optional[AccountIds], default: None ) –

    When includeLinkedAccounts is set to true, use this parameter to specify the list of accounts to search. You can specify as many as 20 account IDs in the array.

  • include_linked_accounts (Optional[IncludeLinkedAccounts], default: None ) –

    If you are using a monitoring account, set this to true to have the operation return log groups in the accounts listed in accountIdentifiers.

    If this parameter is set to true and accountIdentifiers contains a null value, the operation returns all log groups in the monitoring account and all log groups in all source accounts that are linked to the monitoring account.

    The default for this parameter is false.

  • log_group_class (Optional[LogGroupClass], default: None ) –

    Filters the results by log group class to include only log groups of the specified class.

  • log_group_name_pattern (Optional[LogGroupNameRegexPattern], default: None ) –

    Use this parameter to limit the returned log groups to only those with names that match the pattern that you specify. This parameter is a regular expression that can match prefixes and substrings, and supports wildcard matching and matching multiple patterns, as in the following examples.

    • Use ^ to match log group names by prefix.

    • For a substring match, specify the string to match. All matches are case sensitive

    • To match multiple patterns, separate them with a | as in the example ^/aws/lambda|discovery

    You can specify as many as five different regular expression patterns in this field, each of which must be between 3 and 24 characters. You can include the ^ symbol as many as five times, and include the | symbol as many as four times.

  • data_sources (Optional[DataSourceFilters], default: None ) –

    Filters the results by data source characteristics to include only log groups associated with the specified data sources.

  • group_by (ListAggregateLogGroupSummariesGroupBy) –

    Specifies how to group the log groups in the summary.

  • limit (Optional[ListLogGroupsRequestLimit], default: None ) –

    The maximum number of aggregated summaries to return. If you omit this parameter, the default is up to 50 aggregated summaries.

Raises:

Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
def list_aggregate_log_group_summaries(
    self,
    group_by: "capo_cloudwatch_logs.types.list_aggregate_log_group_summaries_group_by.ListAggregateLogGroupSummariesGroupBy",
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
    account_identifiers: Optional[
        "capo_cloudwatch_logs.types.account_ids.AccountIds"
    ] = None,
    include_linked_accounts: Optional[
        "capo_cloudwatch_logs.types.include_linked_accounts.IncludeLinkedAccounts"
    ] = None,
    log_group_class: Optional[
        "capo_cloudwatch_logs.types.log_group_class.LogGroupClass"
    ] = None,
    log_group_name_pattern: Optional[
        "capo_cloudwatch_logs.types.log_group_name_regex_pattern.LogGroupNameRegexPattern"
    ] = None,
    data_sources: Optional[
        "capo_cloudwatch_logs.types.data_source_filters.DataSourceFilters"
    ] = None,
    next_token: Optional["capo_cloudwatch_logs.types.next_token.NextToken"] = None,
    limit: Optional[
        "capo_cloudwatch_logs.types.list_log_groups_request_limit.ListLogGroupsRequestLimit"
    ] = None,
) -> "capo_cloudwatch_logs.types.list_aggregate_log_group_summaries_response.ListAggregateLogGroupSummariesResponse":
    """<p>Returns an aggregate summary of all log groups in the Region grouped by specified data source characteristics. Supports optional filtering by log group class, name patterns, and data sources. If you perform this action in a monitoring account, you can also return aggregated summaries of log groups from source accounts that are linked to the monitoring account. For more information about using cross-account observability to set up monitoring accounts and source accounts, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html">CloudWatch cross-account observability</a>.</p> <p>The operation aggregates log groups by data source name and type and optionally format, providing counts of log groups that share these characteristics. The operation paginates results. By default, it returns up to 50 results and includes a token to retrieve more results.</p>

    Args:
        account_identifiers: <p>When <code>includeLinkedAccounts</code> is set to <code>true</code>, use this parameter to specify the list of accounts to search. You can specify as many as 20 account IDs in the array.</p>
        include_linked_accounts: <p>If you are using a monitoring account, set this to <code>true</code> to have the operation return log groups in the accounts listed in <code>accountIdentifiers</code>.</p> <p>If this parameter is set to <code>true</code> and <code>accountIdentifiers</code> contains a null value, the operation returns all log groups in the monitoring account and all log groups in all source accounts that are linked to the monitoring account. </p> <p>The default for this parameter is <code>false</code>.</p>
        log_group_class: <p>Filters the results by log group class to include only log groups of the specified class.</p>
        log_group_name_pattern: <p>Use this parameter to limit the returned log groups to only those with names that match the pattern that you specify. This parameter is a regular expression that can match prefixes and substrings, and supports wildcard matching and matching multiple patterns, as in the following examples. </p> <ul> <li> <p>Use <code>^</code> to match log group names by prefix.</p> </li> <li> <p>For a substring match, specify the string to match. All matches are case sensitive</p> </li> <li> <p>To match multiple patterns, separate them with a <code>|</code> as in the example <code>^/aws/lambda|discovery</code> </p> </li> </ul> <p>You can specify as many as five different regular expression patterns in this field, each of which must be between 3 and 24 characters. You can include the <code>^</code> symbol as many as five times, and include the <code>|</code> symbol as many as four times.</p>
        data_sources: <p>Filters the results by data source characteristics to include only log groups associated with the specified data sources.</p>
        group_by: <p>Specifies how to group the log groups in the summary.</p>
        limit: <p>The maximum number of aggregated summaries to return. If you omit this parameter, the default is up to 50 aggregated summaries.</p>

    Raises:
        capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
        capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
        capo_cloudwatch_logs.errors.validation_exception.ValidationException: <p>One of the parameters for the request is not valid.</p>
        capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch_logs.types.list_aggregate_log_group_summaries_request.ListAggregateLogGroupSummariesRequest]",
    ) -> OperationResponse[
        "capo_cloudwatch_logs.types.list_aggregate_log_group_summaries_response.ListAggregateLogGroupSummariesResponse"
    ]:
        import capo_cloudwatch_logs._operations.logs_20140328.list_aggregate_log_group_summaries

        output, http_response = (
            capo_cloudwatch_logs._operations.logs_20140328.list_aggregate_log_group_summaries.list_aggregate_log_group_summaries(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAggregateLogGroupSummaries")
    )
    input_: capo_cloudwatch_logs.types.list_aggregate_log_group_summaries_request.ListAggregateLogGroupSummariesRequest = {
        "group_by": group_by
    }
    if account_identifiers is not None:
        input_["account_identifiers"] = account_identifiers
    if include_linked_accounts is not None:
        input_["include_linked_accounts"] = include_linked_accounts
    if log_group_class is not None:
        input_["log_group_class"] = log_group_class
    if log_group_name_pattern is not None:
        input_["log_group_name_pattern"] = log_group_name_pattern
    if data_sources is not None:
        input_["data_sources"] = data_sources
    if next_token is not None:
        input_["next_token"] = next_token
    if limit is not None:
        input_["limit"] = limit

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output