CloudWatchLogs#
Client#
- class CloudWatchLogs.Client#
A low-level client representing Amazon CloudWatch Logs
You can use Amazon CloudWatch Logs to monitor, store, and access your log files from EC2 instances, CloudTrail, and other sources. You can then retrieve the associated log data from CloudWatch Logs using the CloudWatch console. Alternatively, you can use CloudWatch Logs commands in the Amazon Web Services CLI, CloudWatch Logs API, or CloudWatch Logs SDK.
You can use CloudWatch Logs to:
Monitor logs from EC2 instances in real time: You can use CloudWatch Logs to monitor applications and systems using log data. For example, CloudWatch Logs can track the number of errors that occur in your application logs. Then, it can send you a notification whenever the rate of errors exceeds a threshold that you specify. CloudWatch Logs uses your log data for monitoring so no code changes are required. For example, you can monitor application logs for specific literal terms (such as “NullReferenceException”). You can also count the number of occurrences of a literal term at a particular position in log data (such as “404” status codes in an Apache access log). When the term you are searching for is found, CloudWatch Logs reports the data to a CloudWatch metric that you specify.
Monitor CloudTrail logged events: You can create alarms in CloudWatch and receive notifications of particular API activity as captured by CloudTrail. You can use the notification to perform troubleshooting.
Archive log data: You can use CloudWatch Logs to store your log data in highly durable storage. You can change the log retention setting so that any log events earlier than this setting are automatically deleted. The CloudWatch Logs agent helps to quickly send both rotated and non-rotated log data off of a host and into the log service. You can then access the raw log data when you need it.
import boto3 client = boto3.client('logs')
These are the available methods:
- associate_kms_key
- can_paginate
- cancel_export_task
- close
- create_delivery
- create_export_task
- create_log_group
- create_log_stream
- delete_account_policy
- delete_data_protection_policy
- delete_delivery
- delete_delivery_destination
- delete_delivery_destination_policy
- delete_delivery_source
- delete_destination
- delete_log_group
- delete_log_stream
- delete_metric_filter
- delete_query_definition
- delete_resource_policy
- delete_retention_policy
- delete_subscription_filter
- describe_account_policies
- describe_deliveries
- describe_delivery_destinations
- describe_delivery_sources
- describe_destinations
- describe_export_tasks
- describe_log_groups
- describe_log_streams
- describe_metric_filters
- describe_queries
- describe_query_definitions
- describe_resource_policies
- describe_subscription_filters
- disassociate_kms_key
- filter_log_events
- get_data_protection_policy
- get_delivery
- get_delivery_destination
- get_delivery_destination_policy
- get_delivery_source
- get_log_events
- get_log_group_fields
- get_log_record
- get_paginator
- get_query_results
- get_waiter
- list_tags_for_resource
- list_tags_log_group
- put_account_policy
- put_data_protection_policy
- put_delivery_destination
- put_delivery_destination_policy
- put_delivery_source
- put_destination
- put_destination_policy
- put_log_events
- put_metric_filter
- put_query_definition
- put_resource_policy
- put_retention_policy
- put_subscription_filter
- start_query
- stop_query
- tag_log_group
- tag_resource
- test_metric_filter
- untag_log_group
- untag_resource
Paginators#
Paginators are available on a client instance via the get_paginator
method. For more detailed instructions and examples on the usage of paginators, see the paginators user guide.
The available paginators are: