Skip to content

CloudWatchLogsClient

Index > CloudWatchLogs > CloudWatchLogsClient

Auto-generated documentation for CloudWatchLogs type annotations stubs module mypy-boto3-logs.

CloudWatchLogsClient

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

Usage example
from boto3.session import Session
from mypy_boto3_logs.client import CloudWatchLogsClient

def get_logs_client() -> CloudWatchLogsClient:
    return Session().client("logs")

Exceptions

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

Usage example
client = boto3.client("logs")

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)
Type checking example
from mypy_boto3_logs.client import Exceptions

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

Methods

associate_kms_key

Associates the specified KMS key with the specified log group.

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

Method definition
def associate_kms_key(
    self,
    *,
    logGroupName: str,
    kmsKeyId: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: AssociateKmsKeyRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "kmsKeyId": ...,
}

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

can_paginate

Check if an operation can be paginated.

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

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

cancel_export_task

Cancels the specified export task.

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

Method definition
def cancel_export_task(
    self,
    *,
    taskId: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: CancelExportTaskRequestRequestTypeDef = {  # (1)
    "taskId": ...,
}

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

close

Closes underlying endpoint connections.

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

Method definition
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 boto3.client("logs").create_export_task method. boto3 documentation

Method definition
def create_export_task(
    self,
    *,
    logGroupName: str,
    fromTime: int,
    to: int,
    destination: str,
    taskName: str = ...,
    logStreamNamePrefix: str = ...,
    destinationPrefix: str = ...,
) -> CreateExportTaskResponseTypeDef:  # (1)
    ...
  1. See CreateExportTaskResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").create_log_group method. boto3 documentation

Method definition
def create_log_group(
    self,
    *,
    logGroupName: str,
    kmsKeyId: str = ...,
    tags: Mapping[str, str] = ...,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").create_log_stream method. boto3 documentation

Method definition
def create_log_stream(
    self,
    *,
    logGroupName: str,
    logStreamName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: CreateLogStreamRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "logStreamName": ...,
}

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

delete_data_protection_policy

Deletes the data protection policy from the specified log group.

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

Method definition
def delete_data_protection_policy(
    self,
    *,
    logGroupIdentifier: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").delete_destination method. boto3 documentation

Method definition
def delete_destination(
    self,
    *,
    destinationName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").delete_log_group method. boto3 documentation

Method definition
def delete_log_group(
    self,
    *,
    logGroupName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").delete_log_stream method. boto3 documentation

Method definition
def delete_log_stream(
    self,
    *,
    logGroupName: str,
    logStreamName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").delete_metric_filter method. boto3 documentation

Method definition
def delete_metric_filter(
    self,
    *,
    logGroupName: str,
    filterName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").delete_query_definition method. boto3 documentation

Method definition
def delete_query_definition(
    self,
    *,
    queryDefinitionId: str,
) -> DeleteQueryDefinitionResponseTypeDef:  # (1)
    ...
  1. See DeleteQueryDefinitionResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").delete_resource_policy method. boto3 documentation

Method definition
def delete_resource_policy(
    self,
    *,
    policyName: str = ...,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").delete_retention_policy method. boto3 documentation

Method definition
def delete_retention_policy(
    self,
    *,
    logGroupName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").delete_subscription_filter method. boto3 documentation

Method definition
def delete_subscription_filter(
    self,
    *,
    logGroupName: str,
    filterName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: DeleteSubscriptionFilterRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
    "filterName": ...,
}

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

describe_destinations

Lists all your destinations.

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

Method definition
def describe_destinations(
    self,
    *,
    DestinationNamePrefix: str = ...,
    nextToken: str = ...,
    limit: int = ...,
) -> DescribeDestinationsResponseTypeDef:  # (1)
    ...
  1. See DescribeDestinationsResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").describe_export_tasks method. boto3 documentation

Method definition
def describe_export_tasks(
    self,
    *,
    taskId: str = ...,
    statusCode: ExportTaskStatusCodeType = ...,  # (1)
    nextToken: str = ...,
    limit: int = ...,
) -> DescribeExportTasksResponseTypeDef:  # (2)
    ...
  1. See ExportTaskStatusCodeType
  2. See DescribeExportTasksResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").describe_log_groups method. boto3 documentation

Method definition
def describe_log_groups(
    self,
    *,
    accountIdentifiers: Sequence[str] = ...,
    logGroupNamePrefix: str = ...,
    logGroupNamePattern: str = ...,
    nextToken: str = ...,
    limit: int = ...,
    includeLinkedAccounts: bool = ...,
) -> DescribeLogGroupsResponseTypeDef:  # (1)
    ...
  1. See DescribeLogGroupsResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").describe_log_streams method. boto3 documentation

Method definition
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
Usage example with kwargs
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 boto3.client("logs").describe_metric_filters method. boto3 documentation

Method definition
def describe_metric_filters(
    self,
    *,
    logGroupName: str = ...,
    filterNamePrefix: str = ...,
    nextToken: str = ...,
    limit: int = ...,
    metricName: str = ...,
    metricNamespace: str = ...,
) -> DescribeMetricFiltersResponseTypeDef:  # (1)
    ...
  1. See DescribeMetricFiltersResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").describe_queries method. boto3 documentation

Method definition
def describe_queries(
    self,
    *,
    logGroupName: str = ...,
    status: QueryStatusType = ...,  # (1)
    maxResults: int = ...,
    nextToken: str = ...,
) -> DescribeQueriesResponseTypeDef:  # (2)
    ...
  1. See QueryStatusType
  2. See DescribeQueriesResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").describe_query_definitions method. boto3 documentation

Method definition
def describe_query_definitions(
    self,
    *,
    queryDefinitionNamePrefix: str = ...,
    maxResults: int = ...,
    nextToken: str = ...,
) -> DescribeQueryDefinitionsResponseTypeDef:  # (1)
    ...
  1. See DescribeQueryDefinitionsResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").describe_resource_policies method. boto3 documentation

Method definition
def describe_resource_policies(
    self,
    *,
    nextToken: str = ...,
    limit: int = ...,
) -> DescribeResourcePoliciesResponseTypeDef:  # (1)
    ...
  1. See DescribeResourcePoliciesResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").describe_subscription_filters method. boto3 documentation

Method definition
def describe_subscription_filters(
    self,
    *,
    logGroupName: str,
    filterNamePrefix: str = ...,
    nextToken: str = ...,
    limit: int = ...,
) -> DescribeSubscriptionFiltersResponseTypeDef:  # (1)
    ...
  1. See DescribeSubscriptionFiltersResponseTypeDef
Usage example with kwargs
kwargs: DescribeSubscriptionFiltersRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

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

disassociate_kms_key

Disassociates the associated KMS key from the specified log group.

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

Method definition
def disassociate_kms_key(
    self,
    *,
    logGroupName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").filter_log_events method. boto3 documentation

Method definition
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
Usage example with kwargs
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 boto3.client("logs").generate_presigned_url method. boto3 documentation

Method definition
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 boto3.client("logs").get_data_protection_policy method. boto3 documentation

Method definition
def get_data_protection_policy(
    self,
    *,
    logGroupIdentifier: str,
) -> GetDataProtectionPolicyResponseTypeDef:  # (1)
    ...
  1. See GetDataProtectionPolicyResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").get_log_events method. boto3 documentation

Method definition
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
Usage example with kwargs
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 boto3.client("logs").get_log_group_fields method. boto3 documentation

Method definition
def get_log_group_fields(
    self,
    *,
    logGroupName: str = ...,
    time: int = ...,
    logGroupIdentifier: str = ...,
) -> GetLogGroupFieldsResponseTypeDef:  # (1)
    ...
  1. See GetLogGroupFieldsResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").get_log_record method. boto3 documentation

Method definition
def get_log_record(
    self,
    *,
    logRecordPointer: str,
    unmask: bool = ...,
) -> GetLogRecordResponseTypeDef:  # (1)
    ...
  1. See GetLogRecordResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").get_query_results method. boto3 documentation

Method definition
def get_query_results(
    self,
    *,
    queryId: str,
) -> GetQueryResultsResponseTypeDef:  # (1)
    ...
  1. See GetQueryResultsResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").list_tags_for_resource method. boto3 documentation

Method definition
def list_tags_for_resource(
    self,
    *,
    resourceArn: str,
) -> ListTagsForResourceResponseTypeDef:  # (1)
    ...
  1. See ListTagsForResourceResponseTypeDef
Usage example with kwargs
kwargs: ListTagsForResourceRequestRequestTypeDef = {  # (1)
    "resourceArn": ...,
}

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

list_tags_log_group

.

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

Method definition
def list_tags_log_group(
    self,
    *,
    logGroupName: str,
) -> ListTagsLogGroupResponseTypeDef:  # (1)
    ...
  1. See ListTagsLogGroupResponseTypeDef
Usage example with kwargs
kwargs: ListTagsLogGroupRequestRequestTypeDef = {  # (1)
    "logGroupName": ...,
}

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

put_data_protection_policy

Creates a data protection policy for the specified log group.

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

Method definition
def put_data_protection_policy(
    self,
    *,
    logGroupIdentifier: str,
    policyDocument: str,
) -> PutDataProtectionPolicyResponseTypeDef:  # (1)
    ...
  1. See PutDataProtectionPolicyResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").put_destination method. boto3 documentation

Method definition
def put_destination(
    self,
    *,
    destinationName: str,
    targetArn: str,
    roleArn: str,
    tags: Mapping[str, str] = ...,
) -> PutDestinationResponseTypeDef:  # (1)
    ...
  1. See PutDestinationResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").put_destination_policy method. boto3 documentation

Method definition
def put_destination_policy(
    self,
    *,
    destinationName: str,
    accessPolicy: str,
    forceUpdate: bool = ...,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").put_log_events method. boto3 documentation

Method definition
def put_log_events(
    self,
    *,
    logGroupName: str,
    logStreamName: str,
    logEvents: Sequence[InputLogEventTypeDef],  # (1)
    sequenceToken: str = ...,
) -> PutLogEventsResponseTypeDef:  # (2)
    ...
  1. See InputLogEventTypeDef
  2. See PutLogEventsResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").put_metric_filter method. boto3 documentation

Method definition
def put_metric_filter(
    self,
    *,
    logGroupName: str,
    filterName: str,
    filterPattern: str,
    metricTransformations: Sequence[MetricTransformationTypeDef],  # (1)
) -> EmptyResponseMetadataTypeDef:  # (2)
    ...
  1. See MetricTransformationTypeDef
  2. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").put_query_definition method. boto3 documentation

Method definition
def put_query_definition(
    self,
    *,
    name: str,
    queryString: str,
    queryDefinitionId: str = ...,
    logGroupNames: Sequence[str] = ...,
) -> PutQueryDefinitionResponseTypeDef:  # (1)
    ...
  1. See PutQueryDefinitionResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").put_resource_policy method. boto3 documentation

Method definition
def put_resource_policy(
    self,
    *,
    policyName: str = ...,
    policyDocument: str = ...,
) -> PutResourcePolicyResponseTypeDef:  # (1)
    ...
  1. See PutResourcePolicyResponseTypeDef
Usage example with kwargs
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 boto3.client("logs").put_retention_policy method. boto3 documentation

Method definition
def put_retention_policy(
    self,
    *,
    logGroupName: str,
    retentionInDays: int,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").put_subscription_filter method. boto3 documentation

Method definition
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
Usage example with kwargs
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 boto3.client("logs").start_query method. boto3 documentation

Method definition
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
Usage example with kwargs
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 boto3.client("logs").stop_query method. boto3 documentation

Method definition
def stop_query(
    self,
    *,
    queryId: str,
) -> StopQueryResponseTypeDef:  # (1)
    ...
  1. See StopQueryResponseTypeDef
Usage example with kwargs
kwargs: StopQueryRequestRequestTypeDef = {  # (1)
    "queryId": ...,
}

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

tag_log_group

.

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

Method definition
def tag_log_group(
    self,
    *,
    logGroupName: str,
    tags: Mapping[str, str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").tag_resource method. boto3 documentation

Method definition
def tag_resource(
    self,
    *,
    resourceArn: str,
    tags: Mapping[str, str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").test_metric_filter method. boto3 documentation

Method definition
def test_metric_filter(
    self,
    *,
    filterPattern: str,
    logEventMessages: Sequence[str],
) -> TestMetricFilterResponseTypeDef:  # (1)
    ...
  1. See TestMetricFilterResponseTypeDef
Usage example with kwargs
kwargs: TestMetricFilterRequestRequestTypeDef = {  # (1)
    "filterPattern": ...,
    "logEventMessages": ...,
}

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

untag_log_group

.

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

Method definition
def untag_log_group(
    self,
    *,
    logGroupName: str,
    tags: Sequence[str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
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 boto3.client("logs").untag_resource method. boto3 documentation

Method definition
def untag_resource(
    self,
    *,
    resourceArn: str,
    tagKeys: Sequence[str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
Usage example with kwargs
kwargs: UntagResourceRequestRequestTypeDef = {  # (1)
    "resourceArn": ...,
    "tagKeys": ...,
}

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

get_paginator

Type annotations and code completion for boto3.client("logs").get_paginator method with overloads.