Skip to content

CloudWatchLogsClient#

Index > CloudWatchLogs > CloudWatchLogsClient

Auto-generated documentation for CloudWatchLogs type annotations stubs module types-aiobotocore-logs.

CloudWatchLogsClient#

Type annotations and code completion for session.create_client("logs") boto3 documentation

CloudWatchLogsClient usage example

from aiobotocore.session import get_session
from types_aiobotocore_logs.client import CloudWatchLogsClient

session = get_session()
async with session.create_client("logs") as client:
    client: CloudWatchLogsClient

Exceptions#

aiobotocore client exceptions are generated in runtime. This class provides code completion for session.create_client("logs").exceptions structure.

CloudWatchLogsClient.exceptions usage example

async with session.create_client("logs") as client:
    try:
        do_something(client)
    except (
            client.ClientError,
        client.DataAlreadyAcceptedException,
        client.InvalidOperationException,
        client.InvalidParameterException,
        client.InvalidSequenceTokenException,
        client.LimitExceededException,
        client.MalformedQueryException,
        client.OperationAbortedException,
        client.ResourceAlreadyExistsException,
        client.ResourceNotFoundException,
        client.ServiceUnavailableException,
        client.TooManyTagsException,
        client.UnrecognizedClientException,
    ) as e:
        print(e)
CloudWatchLogsClient usage type checking example

from types_aiobotocore_logs.client import Exceptions

def handle_error(exc: Exceptions.ClientError) -> None:
    ...

Methods#

associate_kms_key#

Associates the specified KMS key with either one log group in the account, or with all stored CloudWatch Logs query insights results in the account.

Type annotations and code completion for session.create_client("logs").associate_kms_key method. boto3 documentation

# associate_kms_key method definition

await def associate_kms_key(
    self,
    *,
    kmsKeyId: str,
    logGroupName: str = ...,
    resourceIdentifier: str = ...,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# associate_kms_key method usage example with argument unpacking

kwargs: AssociateKmsKeyRequestRequestTypeDef = {  # (1)
    "kmsKeyId": ...,
}

parent.associate_kms_key(**kwargs)
  1. See AssociateKmsKeyRequestRequestTypeDef

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for session.create_client("logs").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

cancel_export_task#

Cancels the specified export task.

Type annotations and code completion for session.create_client("logs").cancel_export_task method. boto3 documentation

# cancel_export_task method definition

await def cancel_export_task(
    self,
    *,
    taskId: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# cancel_export_task method usage example with argument unpacking

kwargs: CancelExportTaskRequestRequestTypeDef = {  # (1)
    "taskId": ...,
}

parent.cancel_export_task(**kwargs)
  1. See CancelExportTaskRequestRequestTypeDef

close#

Closes underlying endpoint connections.

Type annotations and code completion for session.create_client("logs").close method. boto3 documentation

# close method definition

await def close(
    self,
) -> None:
    ...

create_export_task#

Creates an export task so that you can efficiently export data from a log group to an Amazon S3 bucket.

Type annotations and code completion for session.create_client("logs").create_export_task method. boto3 documentation

# create_export_task method definition

await def create_export_task(
    self,
    *,
    logGroupName: str,
    fromTime: int,
    to: int,
    destination: str,
    taskName: str = ...,
    logStreamNamePrefix: str = ...,
    destinationPrefix: str = ...,
) -> CreateExportTaskResponseTypeDef:  # (1)
    ...
  1. See CreateExportTaskResponseTypeDef
# create_export_task method usage example with argument unpacking

kwargs: CreateExportTaskRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "fromTime": ...,
    "to": ...,
    "destination": ...,
}

parent.create_export_task(**kwargs)
  1. See CreateExportTaskRequestRequestTypeDef

create_log_group#

Creates a log group with the specified name.

Type annotations and code completion for session.create_client("logs").create_log_group method. boto3 documentation

# create_log_group method definition

await def create_log_group(
    self,
    *,
    logGroupName: str,
    kmsKeyId: str = ...,
    tags: Mapping[str, str] = ...,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# create_log_group method usage example with argument unpacking

kwargs: CreateLogGroupRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.create_log_group(**kwargs)
  1. See CreateLogGroupRequestRequestTypeDef

create_log_stream#

Creates a log stream for the specified log group.

Type annotations and code completion for session.create_client("logs").create_log_stream method. boto3 documentation

# create_log_stream method definition

await def create_log_stream(
    self,
    *,
    logGroupName: str,
    logStreamName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# create_log_stream method usage example with argument unpacking

kwargs: CreateLogStreamRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "logStreamName": ...,
}

parent.create_log_stream(**kwargs)
  1. See CreateLogStreamRequestRequestTypeDef

delete_account_policy#

Deletes a CloudWatch Logs account policy.

Type annotations and code completion for session.create_client("logs").delete_account_policy method. boto3 documentation

# delete_account_policy method definition

await def delete_account_policy(
    self,
    *,
    policyName: str,
    policyType: PolicyTypeType,  # (1)
) -> EmptyResponseMetadataTypeDef:  # (2)
    ...
  1. See PolicyTypeType
  2. See EmptyResponseMetadataTypeDef
# delete_account_policy method usage example with argument unpacking

kwargs: DeleteAccountPolicyRequestRequestTypeDef = {  # (1)
    "policyName": ...,
    "policyType": ...,
}

parent.delete_account_policy(**kwargs)
  1. See DeleteAccountPolicyRequestRequestTypeDef

delete_data_protection_policy#

Deletes the data protection policy from the specified log group.

Type annotations and code completion for session.create_client("logs").delete_data_protection_policy method. boto3 documentation

# delete_data_protection_policy method definition

await def delete_data_protection_policy(
    self,
    *,
    logGroupIdentifier: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_data_protection_policy method usage example with argument unpacking

kwargs: DeleteDataProtectionPolicyRequestRequestTypeDef = {  # (1)
    "logGroupIdentifier": ...,
}

parent.delete_data_protection_policy(**kwargs)
  1. See DeleteDataProtectionPolicyRequestRequestTypeDef

delete_destination#

Deletes the specified destination, and eventually disables all the subscription filters that publish to it.

Type annotations and code completion for session.create_client("logs").delete_destination method. boto3 documentation

# delete_destination method definition

await def delete_destination(
    self,
    *,
    destinationName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_destination method usage example with argument unpacking

kwargs: DeleteDestinationRequestRequestTypeDef = {  # (1)
    "destinationName": ...,
}

parent.delete_destination(**kwargs)
  1. See DeleteDestinationRequestRequestTypeDef

delete_log_group#

Deletes the specified log group and permanently deletes all the archived log events associated with the log group.

Type annotations and code completion for session.create_client("logs").delete_log_group method. boto3 documentation

# delete_log_group method definition

await def delete_log_group(
    self,
    *,
    logGroupName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_log_group method usage example with argument unpacking

kwargs: DeleteLogGroupRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.delete_log_group(**kwargs)
  1. See DeleteLogGroupRequestRequestTypeDef

delete_log_stream#

Deletes the specified log stream and permanently deletes all the archived log events associated with the log stream.

Type annotations and code completion for session.create_client("logs").delete_log_stream method. boto3 documentation

# delete_log_stream method definition

await def delete_log_stream(
    self,
    *,
    logGroupName: str,
    logStreamName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_log_stream method usage example with argument unpacking

kwargs: DeleteLogStreamRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "logStreamName": ...,
}

parent.delete_log_stream(**kwargs)
  1. See DeleteLogStreamRequestRequestTypeDef

delete_metric_filter#

Deletes the specified metric filter.

Type annotations and code completion for session.create_client("logs").delete_metric_filter method. boto3 documentation

# delete_metric_filter method definition

await def delete_metric_filter(
    self,
    *,
    logGroupName: str,
    filterName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_metric_filter method usage example with argument unpacking

kwargs: DeleteMetricFilterRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "filterName": ...,
}

parent.delete_metric_filter(**kwargs)
  1. See DeleteMetricFilterRequestRequestTypeDef

delete_query_definition#

Deletes a saved CloudWatch Logs Insights query definition.

Type annotations and code completion for session.create_client("logs").delete_query_definition method. boto3 documentation

# delete_query_definition method definition

await def delete_query_definition(
    self,
    *,
    queryDefinitionId: str,
) -> DeleteQueryDefinitionResponseTypeDef:  # (1)
    ...
  1. See DeleteQueryDefinitionResponseTypeDef
# delete_query_definition method usage example with argument unpacking

kwargs: DeleteQueryDefinitionRequestRequestTypeDef = {  # (1)
    "queryDefinitionId": ...,
}

parent.delete_query_definition(**kwargs)
  1. See DeleteQueryDefinitionRequestRequestTypeDef

delete_resource_policy#

Deletes a resource policy from this account.

Type annotations and code completion for session.create_client("logs").delete_resource_policy method. boto3 documentation

# delete_resource_policy method definition

await def delete_resource_policy(
    self,
    *,
    policyName: str = ...,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_resource_policy method usage example with argument unpacking

kwargs: DeleteResourcePolicyRequestRequestTypeDef = {  # (1)
    "policyName": ...,
}

parent.delete_resource_policy(**kwargs)
  1. See DeleteResourcePolicyRequestRequestTypeDef

delete_retention_policy#

Deletes the specified retention policy.

Type annotations and code completion for session.create_client("logs").delete_retention_policy method. boto3 documentation

# delete_retention_policy method definition

await def delete_retention_policy(
    self,
    *,
    logGroupName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_retention_policy method usage example with argument unpacking

kwargs: DeleteRetentionPolicyRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.delete_retention_policy(**kwargs)
  1. See DeleteRetentionPolicyRequestRequestTypeDef

delete_subscription_filter#

Deletes the specified subscription filter.

Type annotations and code completion for session.create_client("logs").delete_subscription_filter method. boto3 documentation

# delete_subscription_filter method definition

await def delete_subscription_filter(
    self,
    *,
    logGroupName: str,
    filterName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# delete_subscription_filter method usage example with argument unpacking

kwargs: DeleteSubscriptionFilterRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "filterName": ...,
}

parent.delete_subscription_filter(**kwargs)
  1. See DeleteSubscriptionFilterRequestRequestTypeDef

describe_account_policies#

Returns a list of all CloudWatch Logs account policies in the account.

Type annotations and code completion for session.create_client("logs").describe_account_policies method. boto3 documentation

# describe_account_policies method definition

await def describe_account_policies(
    self,
    *,
    policyType: PolicyTypeType,  # (1)
    policyName: str = ...,
    accountIdentifiers: Sequence[str] = ...,
) -> DescribeAccountPoliciesResponseTypeDef:  # (2)
    ...
  1. See PolicyTypeType
  2. See DescribeAccountPoliciesResponseTypeDef
# describe_account_policies method usage example with argument unpacking

kwargs: DescribeAccountPoliciesRequestRequestTypeDef = {  # (1)
    "policyType": ...,
}

parent.describe_account_policies(**kwargs)
  1. See DescribeAccountPoliciesRequestRequestTypeDef

describe_destinations#

Lists all your destinations.

Type annotations and code completion for session.create_client("logs").describe_destinations method. boto3 documentation

# describe_destinations method definition

await def describe_destinations(
    self,
    *,
    DestinationNamePrefix: str = ...,
    nextToken: str = ...,
    limit: int = ...,
) -> DescribeDestinationsResponseTypeDef:  # (1)
    ...
  1. See DescribeDestinationsResponseTypeDef
# describe_destinations method usage example with argument unpacking

kwargs: DescribeDestinationsRequestRequestTypeDef = {  # (1)
    "DestinationNamePrefix": ...,
}

parent.describe_destinations(**kwargs)
  1. See DescribeDestinationsRequestRequestTypeDef

describe_export_tasks#

Lists the specified export tasks.

Type annotations and code completion for session.create_client("logs").describe_export_tasks method. boto3 documentation

# describe_export_tasks method definition

await def describe_export_tasks(
    self,
    *,
    taskId: str = ...,
    statusCode: ExportTaskStatusCodeType = ...,  # (1)
    nextToken: str = ...,
    limit: int = ...,
) -> DescribeExportTasksResponseTypeDef:  # (2)
    ...
  1. See ExportTaskStatusCodeType
  2. See DescribeExportTasksResponseTypeDef
# describe_export_tasks method usage example with argument unpacking

kwargs: DescribeExportTasksRequestRequestTypeDef = {  # (1)
    "taskId": ...,
}

parent.describe_export_tasks(**kwargs)
  1. See DescribeExportTasksRequestRequestTypeDef

describe_log_groups#

Lists the specified log groups.

Type annotations and code completion for session.create_client("logs").describe_log_groups method. boto3 documentation

# describe_log_groups method definition

await def describe_log_groups(
    self,
    *,
    accountIdentifiers: Sequence[str] = ...,
    logGroupNamePrefix: str = ...,
    logGroupNamePattern: str = ...,
    nextToken: str = ...,
    limit: int = ...,
    includeLinkedAccounts: bool = ...,
) -> DescribeLogGroupsResponseTypeDef:  # (1)
    ...
  1. See DescribeLogGroupsResponseTypeDef
# describe_log_groups method usage example with argument unpacking

kwargs: DescribeLogGroupsRequestRequestTypeDef = {  # (1)
    "accountIdentifiers": ...,
}

parent.describe_log_groups(**kwargs)
  1. See DescribeLogGroupsRequestRequestTypeDef

describe_log_streams#

Lists the log streams for the specified log group.

Type annotations and code completion for session.create_client("logs").describe_log_streams method. boto3 documentation

# describe_log_streams method definition

await def describe_log_streams(
    self,
    *,
    logGroupName: str = ...,
    logGroupIdentifier: str = ...,
    logStreamNamePrefix: str = ...,
    orderBy: OrderByType = ...,  # (1)
    descending: bool = ...,
    nextToken: str = ...,
    limit: int = ...,
) -> DescribeLogStreamsResponseTypeDef:  # (2)
    ...
  1. See OrderByType
  2. See DescribeLogStreamsResponseTypeDef
# describe_log_streams method usage example with argument unpacking

kwargs: DescribeLogStreamsRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.describe_log_streams(**kwargs)
  1. See DescribeLogStreamsRequestRequestTypeDef

describe_metric_filters#

Lists the specified metric filters.

Type annotations and code completion for session.create_client("logs").describe_metric_filters method. boto3 documentation

# describe_metric_filters method definition

await def describe_metric_filters(
    self,
    *,
    logGroupName: str = ...,
    filterNamePrefix: str = ...,
    nextToken: str = ...,
    limit: int = ...,
    metricName: str = ...,
    metricNamespace: str = ...,
) -> DescribeMetricFiltersResponseTypeDef:  # (1)
    ...
  1. See DescribeMetricFiltersResponseTypeDef
# describe_metric_filters method usage example with argument unpacking

kwargs: DescribeMetricFiltersRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.describe_metric_filters(**kwargs)
  1. See DescribeMetricFiltersRequestRequestTypeDef

describe_queries#

Returns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this account.

Type annotations and code completion for session.create_client("logs").describe_queries method. boto3 documentation

# describe_queries method definition

await def describe_queries(
    self,
    *,
    logGroupName: str = ...,
    status: QueryStatusType = ...,  # (1)
    maxResults: int = ...,
    nextToken: str = ...,
) -> DescribeQueriesResponseTypeDef:  # (2)
    ...
  1. See QueryStatusType
  2. See DescribeQueriesResponseTypeDef
# describe_queries method usage example with argument unpacking

kwargs: DescribeQueriesRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.describe_queries(**kwargs)
  1. See DescribeQueriesRequestRequestTypeDef

describe_query_definitions#

This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions.

Type annotations and code completion for session.create_client("logs").describe_query_definitions method. boto3 documentation

# describe_query_definitions method definition

await def describe_query_definitions(
    self,
    *,
    queryDefinitionNamePrefix: str = ...,
    maxResults: int = ...,
    nextToken: str = ...,
) -> DescribeQueryDefinitionsResponseTypeDef:  # (1)
    ...
  1. See DescribeQueryDefinitionsResponseTypeDef
# describe_query_definitions method usage example with argument unpacking

kwargs: DescribeQueryDefinitionsRequestRequestTypeDef = {  # (1)
    "queryDefinitionNamePrefix": ...,
}

parent.describe_query_definitions(**kwargs)
  1. See DescribeQueryDefinitionsRequestRequestTypeDef

describe_resource_policies#

Lists the resource policies in this account.

Type annotations and code completion for session.create_client("logs").describe_resource_policies method. boto3 documentation

# describe_resource_policies method definition

await def describe_resource_policies(
    self,
    *,
    nextToken: str = ...,
    limit: int = ...,
) -> DescribeResourcePoliciesResponseTypeDef:  # (1)
    ...
  1. See DescribeResourcePoliciesResponseTypeDef
# describe_resource_policies method usage example with argument unpacking

kwargs: DescribeResourcePoliciesRequestRequestTypeDef = {  # (1)
    "nextToken": ...,
}

parent.describe_resource_policies(**kwargs)
  1. See DescribeResourcePoliciesRequestRequestTypeDef

describe_subscription_filters#

Lists the subscription filters for the specified log group.

Type annotations and code completion for session.create_client("logs").describe_subscription_filters method. boto3 documentation

# describe_subscription_filters method definition

await def describe_subscription_filters(
    self,
    *,
    logGroupName: str,
    filterNamePrefix: str = ...,
    nextToken: str = ...,
    limit: int = ...,
) -> DescribeSubscriptionFiltersResponseTypeDef:  # (1)
    ...
  1. See DescribeSubscriptionFiltersResponseTypeDef
# describe_subscription_filters method usage example with argument unpacking

kwargs: DescribeSubscriptionFiltersRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.describe_subscription_filters(**kwargs)
  1. See DescribeSubscriptionFiltersRequestRequestTypeDef

disassociate_kms_key#

Disassociates the specified KMS key from the specified log group or from all CloudWatch Logs Insights query results in the account.

Type annotations and code completion for session.create_client("logs").disassociate_kms_key method. boto3 documentation

# disassociate_kms_key method definition

await def disassociate_kms_key(
    self,
    *,
    logGroupName: str = ...,
    resourceIdentifier: str = ...,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# disassociate_kms_key method usage example with argument unpacking

kwargs: DisassociateKmsKeyRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.disassociate_kms_key(**kwargs)
  1. See DisassociateKmsKeyRequestRequestTypeDef

filter_log_events#

Lists log events from the specified log group.

Type annotations and code completion for session.create_client("logs").filter_log_events method. boto3 documentation

# filter_log_events method definition

await def filter_log_events(
    self,
    *,
    logGroupName: str = ...,
    logGroupIdentifier: str = ...,
    logStreamNames: Sequence[str] = ...,
    logStreamNamePrefix: str = ...,
    startTime: int = ...,
    endTime: int = ...,
    filterPattern: str = ...,
    nextToken: str = ...,
    limit: int = ...,
    interleaved: bool = ...,
    unmask: bool = ...,
) -> FilterLogEventsResponseTypeDef:  # (1)
    ...
  1. See FilterLogEventsResponseTypeDef
# filter_log_events method usage example with argument unpacking

kwargs: FilterLogEventsRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.filter_log_events(**kwargs)
  1. See FilterLogEventsRequestRequestTypeDef

generate_presigned_url#

Generate a presigned url given a client, its method, and arguments.

Type annotations and code completion for session.create_client("logs").generate_presigned_url method. boto3 documentation

# generate_presigned_url method definition

await def generate_presigned_url(
    self,
    ClientMethod: str,
    Params: Mapping[str, Any] = ...,
    ExpiresIn: int = 3600,
    HttpMethod: str = ...,
) -> str:
    ...

get_data_protection_policy#

Returns information about a log group data protection policy.

Type annotations and code completion for session.create_client("logs").get_data_protection_policy method. boto3 documentation

# get_data_protection_policy method definition

await def get_data_protection_policy(
    self,
    *,
    logGroupIdentifier: str,
) -> GetDataProtectionPolicyResponseTypeDef:  # (1)
    ...
  1. See GetDataProtectionPolicyResponseTypeDef
# get_data_protection_policy method usage example with argument unpacking

kwargs: GetDataProtectionPolicyRequestRequestTypeDef = {  # (1)
    "logGroupIdentifier": ...,
}

parent.get_data_protection_policy(**kwargs)
  1. See GetDataProtectionPolicyRequestRequestTypeDef

get_log_events#

Lists log events from the specified log stream.

Type annotations and code completion for session.create_client("logs").get_log_events method. boto3 documentation

# get_log_events method definition

await def get_log_events(
    self,
    *,
    logStreamName: str,
    logGroupName: str = ...,
    logGroupIdentifier: str = ...,
    startTime: int = ...,
    endTime: int = ...,
    nextToken: str = ...,
    limit: int = ...,
    startFromHead: bool = ...,
    unmask: bool = ...,
) -> GetLogEventsResponseTypeDef:  # (1)
    ...
  1. See GetLogEventsResponseTypeDef
# get_log_events method usage example with argument unpacking

kwargs: GetLogEventsRequestRequestTypeDef = {  # (1)
    "logStreamName": ...,
}

parent.get_log_events(**kwargs)
  1. See GetLogEventsRequestRequestTypeDef

get_log_group_fields#

Returns a list of the fields that are included in log events in the specified log group.

Type annotations and code completion for session.create_client("logs").get_log_group_fields method. boto3 documentation

# get_log_group_fields method definition

await def get_log_group_fields(
    self,
    *,
    logGroupName: str = ...,
    time: int = ...,
    logGroupIdentifier: str = ...,
) -> GetLogGroupFieldsResponseTypeDef:  # (1)
    ...
  1. See GetLogGroupFieldsResponseTypeDef
# get_log_group_fields method usage example with argument unpacking

kwargs: GetLogGroupFieldsRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.get_log_group_fields(**kwargs)
  1. See GetLogGroupFieldsRequestRequestTypeDef

get_log_record#

Retrieves all of the fields and values of a single log event.

Type annotations and code completion for session.create_client("logs").get_log_record method. boto3 documentation

# get_log_record method definition

await def get_log_record(
    self,
    *,
    logRecordPointer: str,
    unmask: bool = ...,
) -> GetLogRecordResponseTypeDef:  # (1)
    ...
  1. See GetLogRecordResponseTypeDef
# get_log_record method usage example with argument unpacking

kwargs: GetLogRecordRequestRequestTypeDef = {  # (1)
    "logRecordPointer": ...,
}

parent.get_log_record(**kwargs)
  1. See GetLogRecordRequestRequestTypeDef

get_query_results#

Returns the results from the specified query.

Type annotations and code completion for session.create_client("logs").get_query_results method. boto3 documentation

# get_query_results method definition

await def get_query_results(
    self,
    *,
    queryId: str,
) -> GetQueryResultsResponseTypeDef:  # (1)
    ...
  1. See GetQueryResultsResponseTypeDef
# get_query_results method usage example with argument unpacking

kwargs: GetQueryResultsRequestRequestTypeDef = {  # (1)
    "queryId": ...,
}

parent.get_query_results(**kwargs)
  1. See GetQueryResultsRequestRequestTypeDef

list_tags_for_resource#

Displays the tags associated with a CloudWatch Logs resource.

Type annotations and code completion for session.create_client("logs").list_tags_for_resource method. boto3 documentation

# list_tags_for_resource method definition

await def list_tags_for_resource(
    self,
    *,
    resourceArn: str,
) -> ListTagsForResourceResponseTypeDef:  # (1)
    ...
  1. See ListTagsForResourceResponseTypeDef
# list_tags_for_resource method usage example with argument unpacking

kwargs: ListTagsForResourceRequestRequestTypeDef = {  # (1)
    "resourceArn": ...,
}

parent.list_tags_for_resource(**kwargs)
  1. See ListTagsForResourceRequestRequestTypeDef

list_tags_log_group#

.

Type annotations and code completion for session.create_client("logs").list_tags_log_group method. boto3 documentation

# list_tags_log_group method definition

await def list_tags_log_group(
    self,
    *,
    logGroupName: str,
) -> ListTagsLogGroupResponseTypeDef:  # (1)
    ...
  1. See ListTagsLogGroupResponseTypeDef
# list_tags_log_group method usage example with argument unpacking

kwargs: ListTagsLogGroupRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

parent.list_tags_log_group(**kwargs)
  1. See ListTagsLogGroupRequestRequestTypeDef

put_account_policy#

Creates an account-level data protection policy that applies to all log groups in the account.

Type annotations and code completion for session.create_client("logs").put_account_policy method. boto3 documentation

# put_account_policy method definition

await def put_account_policy(
    self,
    *,
    policyName: str,
    policyDocument: str,
    policyType: PolicyTypeType,  # (1)
    scope: ScopeType = ...,  # (2)
) -> PutAccountPolicyResponseTypeDef:  # (3)
    ...
  1. See PolicyTypeType
  2. See ScopeType
  3. See PutAccountPolicyResponseTypeDef
# put_account_policy method usage example with argument unpacking

kwargs: PutAccountPolicyRequestRequestTypeDef = {  # (1)
    "policyName": ...,
    "policyDocument": ...,
    "policyType": ...,
}

parent.put_account_policy(**kwargs)
  1. See PutAccountPolicyRequestRequestTypeDef

put_data_protection_policy#

Creates a data protection policy for the specified log group.

Type annotations and code completion for session.create_client("logs").put_data_protection_policy method. boto3 documentation

# put_data_protection_policy method definition

await def put_data_protection_policy(
    self,
    *,
    logGroupIdentifier: str,
    policyDocument: str,
) -> PutDataProtectionPolicyResponseTypeDef:  # (1)
    ...
  1. See PutDataProtectionPolicyResponseTypeDef
# put_data_protection_policy method usage example with argument unpacking

kwargs: PutDataProtectionPolicyRequestRequestTypeDef = {  # (1)
    "logGroupIdentifier": ...,
    "policyDocument": ...,
}

parent.put_data_protection_policy(**kwargs)
  1. See PutDataProtectionPolicyRequestRequestTypeDef

put_destination#

Creates or updates a destination.

Type annotations and code completion for session.create_client("logs").put_destination method. boto3 documentation

# put_destination method definition

await def put_destination(
    self,
    *,
    destinationName: str,
    targetArn: str,
    roleArn: str,
    tags: Mapping[str, str] = ...,
) -> PutDestinationResponseTypeDef:  # (1)
    ...
  1. See PutDestinationResponseTypeDef
# put_destination method usage example with argument unpacking

kwargs: PutDestinationRequestRequestTypeDef = {  # (1)
    "destinationName": ...,
    "targetArn": ...,
    "roleArn": ...,
}

parent.put_destination(**kwargs)
  1. See PutDestinationRequestRequestTypeDef

put_destination_policy#

Creates or updates an access policy associated with an existing destination.

Type annotations and code completion for session.create_client("logs").put_destination_policy method. boto3 documentation

# put_destination_policy method definition

await def put_destination_policy(
    self,
    *,
    destinationName: str,
    accessPolicy: str,
    forceUpdate: bool = ...,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# put_destination_policy method usage example with argument unpacking

kwargs: PutDestinationPolicyRequestRequestTypeDef = {  # (1)
    "destinationName": ...,
    "accessPolicy": ...,
}

parent.put_destination_policy(**kwargs)
  1. See PutDestinationPolicyRequestRequestTypeDef

put_log_events#

Uploads a batch of log events to the specified log stream.

Type annotations and code completion for session.create_client("logs").put_log_events method. boto3 documentation

# put_log_events method definition

await def put_log_events(
    self,
    *,
    logGroupName: str,
    logStreamName: str,
    logEvents: Sequence[InputLogEventTypeDef],  # (1)
    sequenceToken: str = ...,
) -> PutLogEventsResponseTypeDef:  # (2)
    ...
  1. See InputLogEventTypeDef
  2. See PutLogEventsResponseTypeDef
# put_log_events method usage example with argument unpacking

kwargs: PutLogEventsRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "logStreamName": ...,
    "logEvents": ...,
}

parent.put_log_events(**kwargs)
  1. See PutLogEventsRequestRequestTypeDef

put_metric_filter#

Creates or updates a metric filter and associates it with the specified log group.

Type annotations and code completion for session.create_client("logs").put_metric_filter method. boto3 documentation

# put_metric_filter method definition

await def put_metric_filter(
    self,
    *,
    logGroupName: str,
    filterName: str,
    filterPattern: str,
    metricTransformations: Sequence[MetricTransformationTypeDef],  # (1)
) -> EmptyResponseMetadataTypeDef:  # (2)
    ...
  1. See MetricTransformationTypeDef
  2. See EmptyResponseMetadataTypeDef
# put_metric_filter method usage example with argument unpacking

kwargs: PutMetricFilterRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "filterName": ...,
    "filterPattern": ...,
    "metricTransformations": ...,
}

parent.put_metric_filter(**kwargs)
  1. See PutMetricFilterRequestRequestTypeDef

put_query_definition#

Creates or updates a query definition for CloudWatch Logs Insights.

Type annotations and code completion for session.create_client("logs").put_query_definition method. boto3 documentation

# put_query_definition method definition

await def put_query_definition(
    self,
    *,
    name: str,
    queryString: str,
    queryDefinitionId: str = ...,
    logGroupNames: Sequence[str] = ...,
) -> PutQueryDefinitionResponseTypeDef:  # (1)
    ...
  1. See PutQueryDefinitionResponseTypeDef
# put_query_definition method usage example with argument unpacking

kwargs: PutQueryDefinitionRequestRequestTypeDef = {  # (1)
    "name": ...,
    "queryString": ...,
}

parent.put_query_definition(**kwargs)
  1. See PutQueryDefinitionRequestRequestTypeDef

put_resource_policy#

Creates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53.

Type annotations and code completion for session.create_client("logs").put_resource_policy method. boto3 documentation

# put_resource_policy method definition

await def put_resource_policy(
    self,
    *,
    policyName: str = ...,
    policyDocument: str = ...,
) -> PutResourcePolicyResponseTypeDef:  # (1)
    ...
  1. See PutResourcePolicyResponseTypeDef
# put_resource_policy method usage example with argument unpacking

kwargs: PutResourcePolicyRequestRequestTypeDef = {  # (1)
    "policyName": ...,
}

parent.put_resource_policy(**kwargs)
  1. See PutResourcePolicyRequestRequestTypeDef

put_retention_policy#

Sets the retention of the specified log group.

Type annotations and code completion for session.create_client("logs").put_retention_policy method. boto3 documentation

# put_retention_policy method definition

await def put_retention_policy(
    self,
    *,
    logGroupName: str,
    retentionInDays: int,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# put_retention_policy method usage example with argument unpacking

kwargs: PutRetentionPolicyRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "retentionInDays": ...,
}

parent.put_retention_policy(**kwargs)
  1. See PutRetentionPolicyRequestRequestTypeDef

put_subscription_filter#

Creates or updates a subscription filter and associates it with the specified log group.

Type annotations and code completion for session.create_client("logs").put_subscription_filter method. boto3 documentation

# put_subscription_filter method definition

await def put_subscription_filter(
    self,
    *,
    logGroupName: str,
    filterName: str,
    filterPattern: str,
    destinationArn: str,
    roleArn: str = ...,
    distribution: DistributionType = ...,  # (1)
) -> EmptyResponseMetadataTypeDef:  # (2)
    ...
  1. See DistributionType
  2. See EmptyResponseMetadataTypeDef
# put_subscription_filter method usage example with argument unpacking

kwargs: PutSubscriptionFilterRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "filterName": ...,
    "filterPattern": ...,
    "destinationArn": ...,
}

parent.put_subscription_filter(**kwargs)
  1. See PutSubscriptionFilterRequestRequestTypeDef

start_query#

Schedules a query of a log group using CloudWatch Logs Insights.

Type annotations and code completion for session.create_client("logs").start_query method. boto3 documentation

# start_query method definition

await def start_query(
    self,
    *,
    startTime: int,
    endTime: int,
    queryString: str,
    logGroupName: str = ...,
    logGroupNames: Sequence[str] = ...,
    logGroupIdentifiers: Sequence[str] = ...,
    limit: int = ...,
) -> StartQueryResponseTypeDef:  # (1)
    ...
  1. See StartQueryResponseTypeDef
# start_query method usage example with argument unpacking

kwargs: StartQueryRequestRequestTypeDef = {  # (1)
    "startTime": ...,
    "endTime": ...,
    "queryString": ...,
}

parent.start_query(**kwargs)
  1. See StartQueryRequestRequestTypeDef

stop_query#

Stops a CloudWatch Logs Insights query that is in progress.

Type annotations and code completion for session.create_client("logs").stop_query method. boto3 documentation

# stop_query method definition

await def stop_query(
    self,
    *,
    queryId: str,
) -> StopQueryResponseTypeDef:  # (1)
    ...
  1. See StopQueryResponseTypeDef
# stop_query method usage example with argument unpacking

kwargs: StopQueryRequestRequestTypeDef = {  # (1)
    "queryId": ...,
}

parent.stop_query(**kwargs)
  1. See StopQueryRequestRequestTypeDef

tag_log_group#

.

Type annotations and code completion for session.create_client("logs").tag_log_group method. boto3 documentation

# tag_log_group method definition

await def tag_log_group(
    self,
    *,
    logGroupName: str,
    tags: Mapping[str, str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# tag_log_group method usage example with argument unpacking

kwargs: TagLogGroupRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "tags": ...,
}

parent.tag_log_group(**kwargs)
  1. See TagLogGroupRequestRequestTypeDef

tag_resource#

Assigns one or more tags (key-value pairs) to the specified CloudWatch Logs resource.

Type annotations and code completion for session.create_client("logs").tag_resource method. boto3 documentation

# tag_resource method definition

await def tag_resource(
    self,
    *,
    resourceArn: str,
    tags: Mapping[str, str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# tag_resource method usage example with argument unpacking

kwargs: TagResourceRequestRequestTypeDef = {  # (1)
    "resourceArn": ...,
    "tags": ...,
}

parent.tag_resource(**kwargs)
  1. See TagResourceRequestRequestTypeDef

test_metric_filter#

Tests the filter pattern of a metric filter against a sample of log event messages.

Type annotations and code completion for session.create_client("logs").test_metric_filter method. boto3 documentation

# test_metric_filter method definition

await def test_metric_filter(
    self,
    *,
    filterPattern: str,
    logEventMessages: Sequence[str],
) -> TestMetricFilterResponseTypeDef:  # (1)
    ...
  1. See TestMetricFilterResponseTypeDef
# test_metric_filter method usage example with argument unpacking

kwargs: TestMetricFilterRequestRequestTypeDef = {  # (1)
    "filterPattern": ...,
    "logEventMessages": ...,
}

parent.test_metric_filter(**kwargs)
  1. See TestMetricFilterRequestRequestTypeDef

untag_log_group#

.

Type annotations and code completion for session.create_client("logs").untag_log_group method. boto3 documentation

# untag_log_group method definition

await def untag_log_group(
    self,
    *,
    logGroupName: str,
    tags: Sequence[str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# untag_log_group method usage example with argument unpacking

kwargs: UntagLogGroupRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "tags": ...,
}

parent.untag_log_group(**kwargs)
  1. See UntagLogGroupRequestRequestTypeDef

untag_resource#

Removes one or more tags from the specified resource.

Type annotations and code completion for session.create_client("logs").untag_resource method. boto3 documentation

# untag_resource method definition

await def untag_resource(
    self,
    *,
    resourceArn: str,
    tagKeys: Sequence[str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# untag_resource method usage example with argument unpacking

kwargs: UntagResourceRequestRequestTypeDef = {  # (1)
    "resourceArn": ...,
    "tagKeys": ...,
}

parent.untag_resource(**kwargs)
  1. See UntagResourceRequestRequestTypeDef

__aenter__#

Type annotations and code completion for session.create_client("logs").__aenter__ method. boto3 documentation

# __aenter__ method definition

await def __aenter__(
    self,
) -> CloudWatchLogsClient:
    ...

__aexit__#

Type annotations and code completion for session.create_client("logs").__aexit__ method. boto3 documentation

# __aexit__ method definition

await def __aexit__(
    self,
    exc_type: Any,
    exc_val: Any,
    exc_tb: Any,
) -> Any:
    ...

get_paginator#

Type annotations and code completion for session.create_client("logs").get_paginator method with overloads.