Skip to content

CloudWatchLogsClient.describe_log_groups

rboto-cloudwatch-logs==0.4.0 · Service index · Types

Model summary (excerpt): Returns information about log groups, including data sources that ingest into each log group. You can return all your log groups or filter the results by prefix. The results are ASCII-sorted by log group name. If an account-level retention policy applies to a log group, retentionInDays shows the retention period from that policy, and retentionPolicyName shows the name of the policy. CloudWatch...

Install and imports

python -m pip install "rboto[cloudwatch-logs]==0.4.0"
from rboto import CloudWatchLogsClient
from collections.abc import Sequence
from rboto_cloudwatch_logs.types import (
    DescribeLogGroupsOutput,
    LogGroupClass,
)

Signature

async def describe_log_groups(
    *,
    account_identifiers: Sequence[str] | None = None,
    log_group_name_prefix: str | None = None,
    log_group_name_pattern: str | None = None,
    next_token: str | None = None,
    limit: int | None = None,
    include_linked_accounts: bool | None = None,
    log_group_class: LogGroupClass | None = None,
    log_group_identifiers: Sequence[str] | None = None,
) -> DescribeLogGroupsOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
account_identifiers No 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.
log_group_name_prefix No The prefix to match. logGroupNamePrefix and logGroupNamePattern are mutually exclusive. Only one of these parameters can be passed.
log_group_name_pattern No If you specify a string for this parameter, the operation returns only log groups that have names that match the string based on a case-sensitive substring search. For example, if you specify DataLogs , log groups named DataLogs , aws/DataLogs , and GroupDataLogs would match, but datalogs , Data/log/s and Groupdata would not match. If you specify logGroupNamePattern in your request, then only...
next_token No The token for the next set of items to return. (You received this token from a previous call.)
limit No The maximum number of items returned. If you don't specify a value, the default is up to 50 items.
include_linked_accounts No 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...
log_group_class No Use this parameter to limit the results to only those log groups in the specified log group class. If you omit this parameter, log groups of all classes can be returned. If you specify either INFREQUENT_ACCESS or ESSENTIALS , the results include log groups in both the Infrequent Access and Essentials log classes. Specifies the log group class for this log group. There are four classes: The...
log_group_identifiers No Use this array to filter the list of log groups returned. If you specify this parameter, the only other filter that you can choose to specify is includeLinkedAccounts . If you are using this operation in a monitoring account, you can specify the ARNs of log groups in source accounts and in the monitoring account itself. If you are using this operation in an account that is not a cross-account...

Output

DescribeLogGroupsOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
log_groups list[LogGroupOutput] | None Always present LogGroupOutput
next_token str | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

DescribeLogGroupsOutput, LogGroupClass

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

client.paginators.describe_log_groups(...) accepts the same arguments and returns AsyncIterator[DescribeLogGroupsOutput]. Direct calls return one page. Pages preserve the Output representation above.

Input cursors: next_token. Page-size argument: limit.

No output stream.

Errors

Import from rboto_cloudwatch_logs.exceptions:

InvalidParameterError, ServiceUnavailableError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Example

Complete, type-checked service example. Replace its placeholders and configure credentials before running it.

import asyncio

from rboto import CloudWatchLogsClient


async def main() -> None:
    client = CloudWatchLogsClient(region="us-east-1")
    response = await client.describe_log_groups(log_group_name_prefix="/aws/lambda/", limit=10)
    for group in response.log_groups or []:
        print(group.log_group_name)


if __name__ == "__main__":
    asyncio.run(main())

Service guide · Pinned model