CloudWatchLogs class

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.

Constructors

CloudWatchLogs({required String region, AwsClientCredentials? credentials, AwsClientCredentialsProvider? credentialsProvider, Client? client, String? endpointUrl})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

associateKmsKey({required String kmsKeyId, String? logGroupName, String? resourceIdentifier}) Future<void>
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.
associateSourceToS3TableIntegration({required DataSource dataSource, required String integrationArn}) Future<AssociateSourceToS3TableIntegrationResponse>
Associates a data source with an S3 Table Integration for query access in the 'logs' namespace. This enables querying log data using analytics engines that support Iceberg such as Amazon Athena, Amazon Redshift, and Apache Spark.
cancelExportTask({required String taskId}) Future<void>
Cancels the specified export task.
cancelImportTask({required String importId}) Future<CancelImportTaskResponse>
Cancels an active import task and stops importing data from the CloudTrail Lake Event Data Store.
close() → void
Closes the internal HTTP client if none was provided at creation. If a client was passed as a constructor argument, this becomes a noop.
createDelivery({required String deliveryDestinationArn, required String deliverySourceName, String? fieldDelimiter, List<String>? recordFields, S3DeliveryConfiguration? s3DeliveryConfiguration, Map<String, String>? tags}) Future<CreateDeliveryResponse>
Creates a delivery. A delivery is a connection between a logical delivery source and a logical delivery destination that you have already created.
createExportTask({required String destination, required int from, required String logGroupName, required int to, String? destinationPrefix, String? logStreamNamePrefix, String? taskName}) Future<CreateExportTaskResponse>
Creates an export task so that you can efficiently export data from a log group to an Amazon S3 bucket. When you perform a CreateExportTask operation, you must use credentials that have permission to write to the S3 bucket that you specify as the destination.
createImportTask({required String importRoleArn, required String importSourceArn, ImportFilter? importFilter}) Future<CreateImportTaskResponse>
Starts an import from a data source to CloudWatch Log and creates a managed log group as the destination for the imported data. Currently, CloudTrail Event Data Store is the only supported data source.
createLogAnomalyDetector({required List<String> logGroupArnList, int? anomalyVisibilityTime, String? detectorName, EvaluationFrequency? evaluationFrequency, String? filterPattern, String? kmsKeyId, Map<String, String>? tags}) Future<CreateLogAnomalyDetectorResponse>
Creates an anomaly detector that regularly scans one or more log groups and look for patterns and anomalies in the logs.
createLogGroup({required String logGroupName, bool? deletionProtectionEnabled, String? kmsKeyId, LogGroupClass? logGroupClass, Map<String, String>? tags}) Future<void>
Creates a log group with the specified name. You can create up to 1,000,000 log groups per Region per account.
createLogStream({required String logGroupName, required String logStreamName}) Future<void>
Creates a log stream for the specified log group. A log stream is a sequence of log events that originate from a single source, such as an application instance or a resource that is being monitored.
createLookupTable({required String lookupTableName, required String tableBody, String? description, String? kmsKeyId, Map<String, String>? tags}) Future<CreateLookupTableResponse>
Creates a lookup table by uploading CSV data. You can use lookup tables to enrich log data in CloudWatch Logs Insights queries with reference data such as user details, application names, or error descriptions.
createScheduledQuery({required String executionRoleArn, required String name, required QueryLanguage queryLanguage, required String queryString, required String scheduleExpression, String? description, DestinationConfiguration? destinationConfiguration, List<String>? logGroupIdentifiers, int? scheduleEndTime, int? scheduleStartTime, int? startTimeOffset, ScheduledQueryState? state, Map<String, String>? tags, String? timezone}) Future<CreateScheduledQueryResponse>
Creates a scheduled query that runs CloudWatch Logs Insights queries at regular intervals. Scheduled queries enable proactive monitoring by automatically executing queries to detect patterns and anomalies in your log data. Query results can be delivered to Amazon S3 for analysis or further processing.
deleteAccountPolicy({required String policyName, required PolicyType policyType}) Future<void>
Deletes a CloudWatch Logs account policy. This stops the account-wide policy from applying to log groups or data sources in the account. If you delete a data protection policy or subscription filter policy, any log-group level policies of those types remain in effect. This operation supports deletion of data source-based field index policies, including facet configurations, in addition to log group-based policies.
deleteDataProtectionPolicy({required String logGroupIdentifier}) Future<void>
Deletes the data protection policy from the specified log group.
deleteDelivery({required String id}) Future<void>
Deletes a delivery. A delivery is a connection between a logical delivery source and a logical delivery destination. Deleting a delivery only deletes the connection between the delivery source and delivery destination. It does not delete the delivery destination or the delivery source.
deleteDeliveryDestination({required String name}) Future<void>
Deletes a delivery destination. A delivery is a connection between a logical delivery source and a logical delivery destination.
deleteDeliveryDestinationPolicy({required String deliveryDestinationName}) Future<void>
Deletes a delivery destination policy. For more information about these policies, see PutDeliveryDestinationPolicy.
deleteDeliverySource({required String name}) Future<void>
Deletes a delivery source. A delivery is a connection between a logical delivery source and a logical delivery destination.
deleteDestination({required String destinationName}) Future<void>
Deletes the specified destination, and eventually disables all the subscription filters that publish to it. This operation does not delete the physical resource encapsulated by the destination.
deleteIndexPolicy({required String logGroupIdentifier}) Future<void>
Deletes a log-group level field index policy that was applied to a single log group. The indexing of the log events that happened before you delete the policy will still be used for as many as 30 days to improve CloudWatch Logs Insights queries.
deleteIntegration({required String integrationName, bool? force}) Future<void>
Deletes the integration between CloudWatch Logs and OpenSearch Service. If your integration has active vended logs dashboards, you must specify true for the force parameter, otherwise the operation will fail. If you delete the integration by setting force to true, all your vended logs dashboards powered by OpenSearch Service will be deleted and the data that was on them will no longer be accessible.
deleteLogAnomalyDetector({required String anomalyDetectorArn}) Future<void>
Deletes the specified CloudWatch Logs anomaly detector.
deleteLogGroup({required String logGroupName}) Future<void>
Deletes the specified log group and permanently deletes all the archived log events associated with the log group.
deleteLogStream({required String logGroupName, required String logStreamName}) Future<void>
Deletes the specified log stream and permanently deletes all the archived log events associated with the log stream.
deleteLookupTable({required String lookupTableArn}) Future<void>
Deletes a lookup table permanently. This operation cannot be undone.
deleteMetricFilter({required String filterName, required String logGroupName}) Future<void>
Deletes the specified metric filter.
deleteQueryDefinition({required String queryDefinitionId}) Future<DeleteQueryDefinitionResponse>
Deletes a saved CloudWatch Logs Insights query definition. A query definition contains details about a saved CloudWatch Logs Insights query.
deleteResourcePolicy({String? expectedRevisionId, String? policyName, String? resourceArn}) Future<void>
Deletes a resource policy from this account. This revokes the access of the identities in that policy to put log events to this account.
deleteRetentionPolicy({required String logGroupName}) Future<void>
Deletes the specified retention policy.
deleteScheduledQuery({required String identifier}) Future<void>
Deletes a scheduled query and stops all future executions. This operation also removes any configured actions and associated resources.
deleteSubscriptionFilter({required String filterName, required String logGroupName}) Future<void>
Deletes the specified subscription filter.
deleteTransformer({required String logGroupIdentifier}) Future<void>
Deletes the log transformer for the specified log group. As soon as you do this, the transformation of incoming log events according to that transformer stops. If this account has an account-level transformer that applies to this log group, the log group begins using that account-level transformer when this log-group level transformer is deleted.
describeAccountPolicies({required PolicyType policyType, List<String>? accountIdentifiers, String? nextToken, String? policyName}) Future<DescribeAccountPoliciesResponse>
Returns a list of all CloudWatch Logs account policies in the account.
describeConfigurationTemplates({List<DeliveryDestinationType>? deliveryDestinationTypes, int? limit, List<String>? logTypes, String? nextToken, List<String>? resourceTypes, String? service}) Future<DescribeConfigurationTemplatesResponse>
Use this operation to return the valid and default values that are used when creating delivery sources, delivery destinations, and deliveries. For more information about deliveries, see CreateDelivery.
describeDeliveries({int? limit, String? nextToken}) Future<DescribeDeliveriesResponse>
Retrieves a list of the deliveries that have been created in the account.
describeDeliveryDestinations({int? limit, String? nextToken}) Future<DescribeDeliveryDestinationsResponse>
Retrieves a list of the delivery destinations that have been created in the account.
describeDeliverySources({int? limit, String? nextToken}) Future<DescribeDeliverySourcesResponse>
Retrieves a list of the delivery sources that have been created in the account.
describeDestinations({String? destinationNamePrefix, int? limit, String? nextToken}) Future<DescribeDestinationsResponse>
Lists all your destinations. The results are ASCII-sorted by destination name.
describeExportTasks({int? limit, String? nextToken, ExportTaskStatusCode? statusCode, String? taskId}) Future<DescribeExportTasksResponse>
Lists the specified export tasks. You can list all your export tasks or filter the results based on task ID or task status.
describeFieldIndexes({required List<String> logGroupIdentifiers, String? nextToken}) Future<DescribeFieldIndexesResponse>
Returns a list of custom and default field indexes which are discovered in log data. For more information about field index policies, see PutIndexPolicy.
describeImportTaskBatches({required String importId, List<ImportStatus>? batchImportStatus, int? limit, String? nextToken}) Future<DescribeImportTaskBatchesResponse>
Gets detailed information about the individual batches within an import task, including their status and any error messages. For CloudTrail Event Data Store sources, a batch refers to a subset of stored events grouped by their eventTime.
describeImportTasks({String? importId, String? importSourceArn, ImportStatus? importStatus, int? limit, String? nextToken}) Future<DescribeImportTasksResponse>
Lists and describes import tasks, with optional filtering by import status and source ARN.
describeIndexPolicies({required List<String> logGroupIdentifiers, String? nextToken}) Future<DescribeIndexPoliciesResponse>
Returns the field index policies of the specified log group. For more information about field index policies, see PutIndexPolicy.
describeLogGroups({List<String>? accountIdentifiers, bool? includeLinkedAccounts, int? limit, LogGroupClass? logGroupClass, List<String>? logGroupIdentifiers, String? logGroupNamePattern, String? logGroupNamePrefix, String? nextToken}) Future<DescribeLogGroupsResponse>
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.
describeLogStreams({bool? descending, int? limit, String? logGroupIdentifier, String? logGroupName, String? logStreamNamePrefix, String? nextToken, OrderBy? orderBy}) Future<DescribeLogStreamsResponse>
Lists the log streams for the specified log group. You can list all the log streams or filter the results by prefix. You can also control how the results are ordered.
describeLookupTables({String? lookupTableNamePrefix, int? maxResults, String? nextToken}) Future<DescribeLookupTablesResponse>
Retrieves metadata about lookup tables in your account. You can optionally filter the results by table name prefix. Results are sorted by table name in ascending order.
describeMetricFilters({String? filterNamePrefix, int? limit, String? logGroupName, String? metricName, String? metricNamespace, String? nextToken}) Future<DescribeMetricFiltersResponse>
Lists the specified metric filters. You can list all of the metric filters or filter the results by log name, prefix, metric name, or metric namespace. The results are ASCII-sorted by filter name.
describeQueries({String? logGroupName, int? maxResults, String? nextToken, QueryLanguage? queryLanguage, QueryStatus? status}) Future<DescribeQueriesResponse>
Returns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this account. You can request all queries or limit it to queries of a specific log group or queries with a certain status.
describeQueryDefinitions({int? maxResults, String? nextToken, String? queryDefinitionNamePrefix, QueryLanguage? queryLanguage}) Future<DescribeQueryDefinitionsResponse>
This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions. You can retrieve query definitions from the current account or from a source account that is linked to the current account.
describeResourcePolicies({int? limit, String? nextToken, PolicyScope? policyScope, String? resourceArn}) Future<DescribeResourcePoliciesResponse>
Lists the resource policies in this account.
describeSubscriptionFilters({required String logGroupName, String? filterNamePrefix, int? limit, String? nextToken}) Future<DescribeSubscriptionFiltersResponse>
Lists the subscription filters for the specified log group. You can list all the subscription filters or filter the results by prefix. The results are ASCII-sorted by filter name.
disassociateKmsKey({String? logGroupName, String? resourceIdentifier}) Future<void>
Disassociates the specified KMS key from the specified log group or from all CloudWatch Logs Insights query results in the account.
disassociateSourceFromS3TableIntegration({required String identifier}) Future<DisassociateSourceFromS3TableIntegrationResponse>
Disassociates a data source from an S3 Table Integration, removing query access and deleting all associated data from the integration.
filterLogEvents({int? endTime, String? filterPattern, bool? interleaved, int? limit, String? logGroupIdentifier, String? logGroupName, String? logStreamNamePrefix, List<String>? logStreamNames, String? nextToken, int? startTime, bool? unmask}) Future<FilterLogEventsResponse>
Lists log events from the specified log group. You can list all the log events or filter the results using one or more of the following:
getDataProtectionPolicy({required String logGroupIdentifier}) Future<GetDataProtectionPolicyResponse>
Returns information about a log group data protection policy.
getDelivery({required String id}) Future<GetDeliveryResponse>
Returns complete information about one logical delivery. A delivery is a connection between a delivery source and a delivery destination .
getDeliveryDestination({required String name}) Future<GetDeliveryDestinationResponse>
Retrieves complete information about one delivery destination.
getDeliveryDestinationPolicy({required String deliveryDestinationName}) Future<GetDeliveryDestinationPolicyResponse>
Retrieves the delivery destination policy assigned to the delivery destination that you specify. For more information about delivery destinations and their policies, see PutDeliveryDestinationPolicy.
getDeliverySource({required String name}) Future<GetDeliverySourceResponse>
Retrieves complete information about one delivery source.
getIntegration({required String integrationName}) Future<GetIntegrationResponse>
Returns information about one integration between CloudWatch Logs and OpenSearch Service.
getLogAnomalyDetector({required String anomalyDetectorArn}) Future<GetLogAnomalyDetectorResponse>
Retrieves information about the log anomaly detector that you specify. The KMS key ARN detected is valid.
getLogEvents({required String logStreamName, int? endTime, int? limit, String? logGroupIdentifier, String? logGroupName, String? nextToken, bool? startFromHead, int? startTime, bool? unmask}) Future<GetLogEventsResponse>
Lists log events from the specified log stream. You can list all of the log events or filter using a time range.
getLogFields({required String dataSourceName, required String dataSourceType}) Future<GetLogFieldsResponse>
Discovers available fields for a specific data source and type. The response includes any field modifications introduced through pipelines, such as new fields or changed field types.
getLogGroupFields({String? logGroupIdentifier, String? logGroupName, int? time}) Future<GetLogGroupFieldsResponse>
Returns a list of the fields that are included in log events in the specified log group. Includes the percentage of log events that contain each field. The search is limited to a time period that you specify.
getLogObject({required String logObjectPointer, bool? unmask}) Future<GetLogObjectResponse>
Retrieves a large logging object (LLO) and streams it back. This API is used to fetch the content of large portions of log events that have been ingested through the PutOpenTelemetryLogs API. When log events contain fields that would cause the total event size to exceed 1MB, CloudWatch Logs automatically processes up to 10 fields, starting with the largest fields. Each field is truncated as needed to keep the total event size as close to 1MB as possible. The excess portions are stored as Large Log Objects (LLOs) and these fields are processed separately and LLO reference system fields (in the format @ptr.$[path.to.field]) are added. The path in the reference field reflects the original JSON structure where the large field was located. For example, this could be @ptr.$['input']['message'], @ptr.$['AAA']['BBB']['CCC']['DDD'], @ptr.$['AAA'], or any other path matching your log structure.
getLogRecord({required String logRecordPointer, bool? unmask}) Future<GetLogRecordResponse>
Retrieves all of the fields and values of a single log event. All fields are retrieved, even if the original query that produced the logRecordPointer retrieved only a subset of fields. Fields are returned as field name/field value pairs.
getLookupTable({required String lookupTableArn}) Future<GetLookupTableResponse>
Retrieves the full content of a lookup table, including the CSV data.
getQueryResults({required String queryId, int? maxItems, String? nextToken}) Future<GetQueryResultsResponse>
Returns the results from the specified query.
getScheduledQuery({required String identifier}) Future<GetScheduledQueryResponse>
Retrieves details about a specific scheduled query, including its configuration, execution status, and metadata.
getScheduledQueryHistory({required int endTime, required String identifier, required int startTime, List<ExecutionStatus>? executionStatuses, int? maxResults, String? nextToken}) Future<GetScheduledQueryHistoryResponse>
Retrieves the execution history of a scheduled query within a specified time range, including query results and destination processing status.
getTransformer({required String logGroupIdentifier}) Future<GetTransformerResponse>
Returns the information about the log transformer associated with this log group.
listAggregateLogGroupSummaries({required ListAggregateLogGroupSummariesGroupBy groupBy, List<String>? accountIdentifiers, List<DataSourceFilter>? dataSources, bool? includeLinkedAccounts, int? limit, LogGroupClass? logGroupClass, String? logGroupNamePattern, String? nextToken}) Future<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.
listAnomalies({String? anomalyDetectorArn, int? limit, String? nextToken, SuppressionState? suppressionState}) Future<ListAnomaliesResponse>
Returns a list of anomalies that log anomaly detectors have found. For details about the structure format of each anomaly object that is returned, see the example in this section.
listIntegrations({String? integrationNamePrefix, IntegrationStatus? integrationStatus, IntegrationType? integrationType}) Future<ListIntegrationsResponse>
Returns a list of integrations between CloudWatch Logs and other services in this account. Currently, only one integration can be created in an account, and this integration must be with OpenSearch Service.
listLogAnomalyDetectors({String? filterLogGroupArn, int? limit, String? nextToken}) Future<ListLogAnomalyDetectorsResponse>
Retrieves a list of the log anomaly detectors in the account.
listLogGroups({List<String>? accountIdentifiers, List<DataSourceFilter>? dataSources, List<String>? fieldIndexNames, bool? includeLinkedAccounts, int? limit, LogGroupClass? logGroupClass, String? logGroupNamePattern, List<TagFilter>? logGroupTags, String? nextToken}) Future<ListLogGroupsResponse>
Returns a list of log groups in the Region in your account. If you are performing this action in a monitoring account, you can choose to also return 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.
listLogGroupsForQuery({required String queryId, int? maxResults, String? nextToken}) Future<ListLogGroupsForQueryResponse>
Returns a list of the log groups that were analyzed during a single CloudWatch Logs Insights query. This can be useful for queries that use log group name prefixes or the filterIndex command, because the log groups are dynamically selected in these cases.
listScheduledQueries({int? maxResults, String? nextToken, ScheduledQueryState? state}) Future<ListScheduledQueriesResponse>
Lists all scheduled queries in your account and region. You can filter results by state to show only enabled or disabled queries.
listSourcesForS3TableIntegration({required String integrationArn, int? maxResults, String? nextToken}) Future<ListSourcesForS3TableIntegrationResponse>
Returns a list of data source associations for a specified S3 Table Integration, showing which data sources are currently associated for query access.
listTagsForResource({required String resourceArn}) Future<ListTagsForResourceResponse>
Displays the tags associated with a CloudWatch Logs resource. Currently, log groups and destinations support tagging.
listTagsLogGroup({required String logGroupName}) Future<ListTagsLogGroupResponse>
May throw ResourceNotFoundException. May throw ServiceUnavailableException.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putAccountPolicy({required String policyDocument, required String policyName, required PolicyType policyType, Scope? scope, String? selectionCriteria}) Future<PutAccountPolicyResponse>
Creates an account-level data protection policy, subscription filter policy, field index policy, transformer policy, or metric extraction policy that applies to all log groups, a subset of log groups, or a data source name and type combination in the account.
putBearerTokenAuthentication({required bool bearerTokenAuthenticationEnabled, required String logGroupIdentifier}) Future<void>
Enables or disables bearer token authentication for the specified log group. When enabled on a log group, bearer token authentication is enabled on operations until it is explicitly disabled.
putDataProtectionPolicy({required String logGroupIdentifier, required String policyDocument}) Future<PutDataProtectionPolicyResponse>
Creates a data protection policy for the specified log group. A data protection policy can help safeguard sensitive data that's ingested by the log group by auditing and masking the sensitive log data. By default, when a user views a log event that includes masked data, the sensitive data is replaced by asterisks. A user who has the logs:Unmask permission can use a GetLogEvents or FilterLogEvents operation with the unmask parameter set to true to view the unmasked log events. Users with the logs:Unmask can also view unmasked data in the CloudWatch Logs console by running a CloudWatch Logs Insights query with the unmask query command.
putDeliveryDestination({required String name, DeliveryDestinationConfiguration? deliveryDestinationConfiguration, DeliveryDestinationType? deliveryDestinationType, OutputFormat? outputFormat, Map<String, String>? tags}) Future<PutDeliveryDestinationResponse>
Creates or updates a logical delivery destination. A delivery destination is an Amazon Web Services resource that represents an Amazon Web Services service that logs can be sent to. CloudWatch Logs, Amazon S3, and Firehose are supported as logs delivery destinations and X-Ray as the trace delivery destination.
putDeliveryDestinationPolicy({required String deliveryDestinationName, required String deliveryDestinationPolicy}) Future<PutDeliveryDestinationPolicyResponse>
Creates and assigns an IAM policy that grants permissions to CloudWatch Logs to deliver logs cross-account to a specified destination in this account. To configure the delivery of logs from an Amazon Web Services service in another account to a logs delivery destination in the current account, you must do the following:
putDeliverySource({required String logType, required String name, required String resourceArn, Map<String, String>? deliverySourceConfiguration, Map<String, String>? tags}) Future<PutDeliverySourceResponse>
Creates or updates a logical delivery source. A delivery source represents an Amazon Web Services resource that sends logs to an logs delivery destination. The destination can be CloudWatch Logs, Amazon S3, Firehose or X-Ray for sending traces.
putDestination({required String destinationName, required String roleArn, required String targetArn, Map<String, String>? tags}) Future<PutDestinationResponse>
Creates or updates a destination. This operation is used only to create destinations for cross-account subscriptions.
putDestinationPolicy({required String accessPolicy, required String destinationName, bool? forceUpdate}) Future<void>
Creates or updates an access policy associated with an existing destination. An access policy is an IAM policy document that is used to authorize claims to register a subscription filter against a given destination.
putIndexPolicy({required String logGroupIdentifier, required String policyDocument}) Future<PutIndexPolicyResponse>
Creates or updates a field index policy for the specified log group. Only log groups in the Standard log class support field index policies. For more information about log classes, see Log classes.
putIntegration({required String integrationName, required IntegrationType integrationType, required ResourceConfig resourceConfig}) Future<PutIntegrationResponse>
Creates an integration between CloudWatch Logs and another service in this account. Currently, only integrations with OpenSearch Service are supported, and currently you can have only one integration in your account.
putLogEvents({required List<InputLogEvent> logEvents, required String logGroupName, required String logStreamName, Entity? entity, String? sequenceToken}) Future<PutLogEventsResponse>
Uploads a batch of log events to the specified log stream. The batch of events must satisfy the following constraints:
putLogGroupDeletionProtection({required bool deletionProtectionEnabled, required String logGroupIdentifier}) Future<void>
Enables or disables deletion protection for the specified log group. When enabled on a log group, deletion protection blocks all deletion operations until it is explicitly disabled.
putMetricFilter({required String filterName, required String filterPattern, required String logGroupName, required List<MetricTransformation> metricTransformations, bool? applyOnTransformedLogs, List<String>? emitSystemFieldDimensions, String? fieldSelectionCriteria}) Future<void>
Creates or updates a metric filter and associates it with the specified log group. With metric filters, you can configure rules to extract metric data from log events ingested through PutLogEvents.
putQueryDefinition({required String name, required String queryString, String? clientToken, List<String>? logGroupNames, List<QueryParameter>? parameters, String? queryDefinitionId, QueryLanguage? queryLanguage}) Future<PutQueryDefinitionResponse>
Creates or updates a query definition for CloudWatch Logs Insights. For more information, see Analyzing Log Data with CloudWatch Logs Insights.
putResourcePolicy({String? expectedRevisionId, String? policyDocument, String? policyName, String? resourceArn}) Future<PutResourcePolicyResponse>
Creates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53. This API has the following restrictions:
putRetentionPolicy({required String logGroupName, required int retentionInDays}) Future<void>
Sets the retention of the specified log group. With a retention policy, you can configure the number of days for which to retain log events in the specified log group.
putSubscriptionFilter({required String destinationArn, required String filterName, required String filterPattern, required String logGroupName, bool? applyOnTransformedLogs, Distribution? distribution, List<String>? emitSystemFields, String? fieldSelectionCriteria, String? roleArn}) Future<void>
Creates or updates a subscription filter and associates it with the specified log group. With subscription filters, you can subscribe to a real-time stream of log events ingested through PutLogEvents and have them delivered to a specific destination. When log events are sent to the receiving service, they are Base64 encoded and compressed with the GZIP format.
putTransformer({required String logGroupIdentifier, required List<Processor> transformerConfig}) Future<void>
Creates or updates a log transformer for a single log group. You use log transformers to transform log events into a different format, making them easier for you to process and analyze. You can also transform logs from different sources into standardized formats that contains relevant, source-specific information.
startLiveTail({required List<String> logGroupIdentifiers, String? logEventFilterPattern, List<String>? logStreamNamePrefixes, List<String>? logStreamNames}) Future<StartLiveTailResponse>
Starts a Live Tail streaming session for one or more log groups. A Live Tail session returns a stream of log events that have been recently ingested in the log groups. For more information, see Use Live Tail to view logs in near real time.
startQuery({required int endTime, required String queryString, required int startTime, int? limit, List<String>? logGroupIdentifiers, String? logGroupName, List<String>? logGroupNames, QueryLanguage? queryLanguage}) Future<StartQueryResponse>
Starts a query of one or more log groups or data sources using CloudWatch Logs Insights. You specify the log groups or data sources and time range to query and the query string to use. You can query up to 10 data sources in a single query.
stopQuery({required String queryId}) Future<StopQueryResponse>
Stops a CloudWatch Logs Insights query that is in progress. If the query has already ended, the operation returns an error indicating that the specified query is not running.
tagLogGroup({required String logGroupName, required Map<String, String> tags}) Future<void>
To list the tags for a log group, use ListTagsForResource. To remove tags, use UntagResource.
tagResource({required String resourceArn, required Map<String, String> tags}) Future<void>
Assigns one or more tags (key-value pairs) to the specified CloudWatch Logs resource. Currently, the only CloudWatch Logs resources that can be tagged are log groups and destinations.
testMetricFilter({required String filterPattern, required List<String> logEventMessages}) Future<TestMetricFilterResponse>
Tests the filter pattern of a metric filter against a sample of log event messages. You can use this operation to validate the correctness of a metric filter pattern.
testTransformer({required List<String> logEventMessages, required List<Processor> transformerConfig}) Future<TestTransformerResponse>
Use this operation to test a log transformer. You enter the transformer configuration and a set of log events to test with. The operation responds with an array that includes the original log events and the transformed versions.
toString() String
A string representation of this object.
inherited
untagLogGroup({required String logGroupName, required List<String> tags}) Future<void>
To list the tags for a log group, use ListTagsForResource. To add tags, use TagResource.
untagResource({required String resourceArn, required List<String> tagKeys}) Future<void>
Removes one or more tags from the specified resource.
updateAnomaly({required String anomalyDetectorArn, String? anomalyId, bool? baseline, String? patternId, SuppressionPeriod? suppressionPeriod, SuppressionType? suppressionType}) Future<void>
Use this operation to suppress anomaly detection for a specified anomaly or pattern. If you suppress an anomaly, CloudWatch Logs won't report new occurrences of that anomaly and won't update that anomaly with new data. If you suppress a pattern, CloudWatch Logs won't report any anomalies related to that pattern.
updateDeliveryConfiguration({required String id, String? fieldDelimiter, List<String>? recordFields, S3DeliveryConfiguration? s3DeliveryConfiguration}) Future<void>
Use this operation to update the configuration of a delivery to change either the S3 path pattern or the format of the delivered logs. You can't use this operation to change the source or destination of the delivery.
updateLogAnomalyDetector({required String anomalyDetectorArn, required bool enabled, int? anomalyVisibilityTime, EvaluationFrequency? evaluationFrequency, String? filterPattern}) Future<void>
Updates an existing log anomaly detector.
updateLookupTable({required String lookupTableArn, required String tableBody, String? description, String? kmsKeyId}) Future<UpdateLookupTableResponse>
Updates an existing lookup table by replacing all of its CSV content. After the update completes, queries that use this table will use the new data.
updateScheduledQuery({required String executionRoleArn, required String identifier, required QueryLanguage queryLanguage, required String queryString, required String scheduleExpression, String? description, DestinationConfiguration? destinationConfiguration, List<String>? logGroupIdentifiers, int? scheduleEndTime, int? scheduleStartTime, int? startTimeOffset, ScheduledQueryState? state, String? timezone}) Future<UpdateScheduledQueryResponse>
Updates an existing scheduled query with new configuration. This operation uses PUT semantics, allowing modification of query parameters, schedule, and destinations.

Operators

operator ==(Object other) bool
The equality operator.
inherited