ExAws.CloudWatchLogs v1.0.0 ExAws.CloudWatchLogs View Source
Operations on AWS CloudWatch Logs API v2014-03-28
See https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/Welcome.html
Link to this section Summary
Functions
Associates the specified KMS key with the specified log group.
Cancels the specified export task. The task must be in the PENDING or RUNNING state.
Creates an export task so that you can efficiently export data from a log group to an Amazon S3 bucket.
Creates a log group with the specified name.
Creates a log stream for the specified log group.
Deletes the data protection policy from the specified log group.
Deletes the specified destination, and eventually disables all the subscription filters that publish to it.
Deletes the specified log group and permanently deletes all the archived log events associated with the log group.
Deletes the specified log stream and permanently deletes all the archived log events associated with the log stream.
Deletes the specified metric filter.
Deletes a saved CloudWatch Logs Insights query definition.
Deletes a resource policy from this account.
Deletes the specified retention policy.
Deletes the specified subscription filter.
Lists all your destinations.
Lists the specified export tasks.
Lists the specified log groups.
Lists the log streams for the specified log group.
Lists the specified metric filters.
Returns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this account.
This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions.
Lists the resource policies in this account.
Lists the subscription filters for the specified log group.
Disassociates the associated KMS key from the specified log group.
Lists log events from the specified log group.
Returns information about a log group data protection policy.
Lists log events from the specified log stream.
Returns a list of the fields that are included in log events in the specified log group.
Retrieves all of the fields and values of a single log event.
Returns the results from the specified query.
Displays the tags associated with a CloudWatch Logs resource.
Creates a data protection policy for the specified log group.
Creates or updates a destination.
Creates or updates an access policy associated with an existing destination.
Uploads a batch of log events to the specified log stream.
Creates or updates a metric filter and associates it with the specified log group.
Creates or updates a query definition for CloudWatch Logs Insights.
Creates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53.
Sets the retention of the specified log group.
Creates or updates a subscription filter and associates it with the specified log group.
Schedules a query of a log group using CloudWatch Logs Insights.
Stops a CloudWatch Logs Insights query that is in progress.
Assigns one or more tags (key-value pairs) to the specified CloudWatch Logs resource.
Tests the filter pattern of a metric filter against a sample of log event messages.
Removes one or more tags from the specified resource.
Link to this section Types
Link to this section Functions
associate_kms_key(log_group_name, kms_key_id)
View Sourceassociate_kms_key(binary(), binary()) :: ExAws.Operation.JSON.t()
Associates the specified KMS key with the specified log group.
Required
log_group_name
- (string) the name of the log groupkms_key_id
- (string) the Amazon Resource Name (ARN) of the KMS key to use when encrypting log data
cancel_export_task(task_id)
View Sourcecancel_export_task(binary()) :: ExAws.Operation.JSON.t()
Cancels the specified export task. The task must be in the PENDING or RUNNING state.
Required
task_id
- (string) the ID of the export task
create_export_task(log_group_name, from, to, destination, opts \\ [])
View SourceCreates an export task so that you can efficiently export data from a log group to an Amazon S3 bucket.
Required
log_group_name
- (string) the name of the log groupfrom
- (long) the start time of the range for the request, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTCto
- (long) the end time of the range for the request, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTCdestination
- (string) the name of S3 bucket for the exported log data. The bucket must be in the same Amazon Web Services Region
Options
task_name - (string) the name of the export task *
log_stream_name_prefix- (string) export only log streams that match the provided prefix. If you don't specify a value, no prefix filter is applied *
destination_prefix- (string) the prefix used as the start of the key for every object exported. If you don't specify a value, the default is
exportedlogs` See AWS API Documentation
create_log_group(log_group_name, opts \\ [])
View Sourcecreate_log_group(binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Creates a log group with the specified name.
Required
log_group_name
- (string) the name of the log group
Options
kms_key_id - (string) the Amazon Resource Name (ARN) of the KMS key to use when encrypting log data *
tags` - (map) the key-value pairs to use for the tags See AWS API Documentation
create_log_stream(log_group_name, log_stream_name)
View Sourcecreate_log_stream(binary(), binary()) :: ExAws.Operation.JSON.t()
Creates a log stream for the specified log group.
Required
log_group_name
- (string) the name of the log grouplog_stream_name
- (string) the name of the log stream
delete_data_protection_policy(log_group_identifier)
View Sourcedelete_data_protection_policy(binary()) :: ExAws.Operation.JSON.t()
Deletes the data protection policy from the specified log group.
Required
log_group_identifier
- (string) the name or ARN of the log group that you want to delete the data protection policy for
delete_destination(destination_name)
View Sourcedelete_destination(binary()) :: ExAws.Operation.JSON.t()
Deletes the specified destination, and eventually disables all the subscription filters that publish to it.
Required
destination_name
- (string) the name of the destination
delete_log_group(log_group_name)
View Sourcedelete_log_group(binary()) :: ExAws.Operation.JSON.t()
Deletes the specified log group and permanently deletes all the archived log events associated with the log group.
Required
log_group_name
- (string) the name of the log group
delete_log_stream(log_group_name, log_stream_name)
View Sourcedelete_log_stream(binary(), binary()) :: ExAws.Operation.JSON.t()
Deletes the specified log stream and permanently deletes all the archived log events associated with the log stream.
Required
log_group_name
- (string) the name of the log grouplog_stream_name
- (string) the name of the log stream
delete_metric_filter(log_group_name, filter_name)
View Sourcedelete_metric_filter(binary(), binary()) :: ExAws.Operation.JSON.t()
Deletes the specified metric filter.
Required
log_group_name
- (string) the name of the log groupfilter_name
- (string) the name of the metric filter.
delete_query_definition(query_definition_id)
View Sourcedelete_query_definition(binary()) :: ExAws.Operation.JSON.t()
Deletes a saved CloudWatch Logs Insights query definition.
Required
query_definition_id
- (string) the ID of the query definition that you want to delete
delete_resource_policy(policy_name)
View Sourcedelete_resource_policy(binary()) :: ExAws.Operation.JSON.t()
Deletes a resource policy from this account.
Required
policy_name
- (string) the name of the policy to be revoked
delete_retention_policy(log_group_name)
View Sourcedelete_retention_policy(binary()) :: ExAws.Operation.JSON.t()
Deletes the specified retention policy.
Required
log_group_name
- (string) the name of the log group
delete_subscription_filter(log_group_name, filter_name)
View Sourcedelete_subscription_filter(binary(), binary()) :: ExAws.Operation.JSON.t()
Deletes the specified subscription filter.
Required
log_group_name
- (string) the name of the log groupfilter_name
- (string) the name of the subscription filter
describe_destinations(opts \\ [])
View Sourcedescribe_destinations(Keyword.t()) :: ExAws.Operation.JSON.t()
Lists all your destinations.
Options
destination_name_prefix
- (string) the prefix to matchnext_token
- (string) the token for the next set of items to return (received from previous call)limit
- (integer) the maximum number of items returned (default is 50)
describe_export_tasks(opts \\ [])
View Sourcedescribe_export_tasks(Keyword.t()) :: ExAws.Operation.JSON.t()
Lists the specified export tasks.
Options
task_id
- (string) the ID of the export taskstatus_code
- (string) the status code of the export task. Specifying a status code filters the results to zero or more export tasks. Possible values:- CANCELLED
- COMPLETED
- FAILED
- PENDING
- PENDING_CANCEL
- RUNNING
next_token
- (string) the token for the next set of items to return (received from previous call)limit
- (integer) the maximum number of items returned (default is 50)
describe_log_groups(opts \\ [])
View Sourcedescribe_log_groups(Keyword.t()) :: ExAws.Operation.JSON.t()
Lists the specified log groups.
Options
account_identifiers
- (list) wheninclude_linked_accounts
is set to True , use this parameter to specify the list of accounts to searchlog_group_name_prefix
- (string) the prefix to matchlog_group_name_pattern
- (string) if you specify a string for this parameter, the operation returns only log groups that have names that match the string based on a case-sensitive substring searchinclude_linked_accounts
- (boolean) if you are using a monitoring account, set this to True to have the operation return log groups in the accounts listed inaccount_identifiers
next_token
- (string) the token for the next set of items to return (received from previous call)limit
- (integer) the maximum number of items returned (default is 50)
describe_log_streams(log_group_name_or_id, opts \\ [])
View Sourcedescribe_log_streams(binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Lists the log streams for the specified log group.
Required
log_group_name_or_id
- (string) the name or ARN of the log group
Options
log_stream_name_prefix
- (string) the prefix to matchorder_by
- (string) if the value isLogStreamName
, the results are ordered by log stream name. If the value isLastEventTime
, the results are ordered by the event time. The default value isLogStreamName
.descending
- (boolean) if the value is true, results are returned in descending order. The defaut is false.next_token
- (string) the token for the next set of items to return (received from previous call)limit
- (integer) the maximum number of items returned (default is 50)
describe_metric_filters(opts \\ [])
View Sourcedescribe_metric_filters(Keyword.t()) :: ExAws.Operation.JSON.t()
Lists the specified metric filters.
Options
log_group_name
- the name of the log groupfilter_name_prefix
- (string) the prefix to matchmetric_name
- filters results to include only those with the specified metric name. If you include this parameter in your request, you must also include themetric_namespace
parametermetric_namespace
- filters results to include only those in the specified namespace. If you include this parameter in your request, you must also include themetric_name
parameternext_token
- (string) the token for the next set of items to return (received from previous call)limit
- (integer) the maximum number of items returned (default is 50)
describe_queries(opts \\ [])
View Sourcedescribe_queries(Keyword.t()) :: ExAws.Operation.JSON.t()
Returns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this account.
Options
log_group_name
- (string) the name of the log groupstatus
- (string) limits the returned queries to only those that have the specified status. Valid values areCancelled
,Complete
,Failed
,Running
, andScheduled
.max_results - (string) imits the number of returned queries to the specified number. *
next_token` - (string) the token for the next set of items to return (received from previous call) See AWS API Documentation
describe_query_definitions(opts \\ [])
View Sourcedescribe_query_definitions(Keyword.t()) :: ExAws.Operation.JSON.t()
This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions.
Options
query_definition_name_prefix
- (string) use this parameter to filter your results to only the query definitions that have names that start with the prefix you specifymax_results
- (integer) limits the number of returned query definitions to the specified numbernext_token
- (string) the token for the next set of items to return. The token expires after 24 hours
describe_resource_policies(opts \\ [])
View Sourcedescribe_resource_policies(Keyword.t()) :: ExAws.Operation.JSON.t()
Lists the resource policies in this account.
Options
next_token
- (string) the token for the next set of items to return (received from previous call)limit
- (integer) the maximum number of items returned (default is 50)
describe_subscription_filters(log_group_name, opts \\ [])
View Sourcedescribe_subscription_filters(binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Lists the subscription filters for the specified log group.
Required
log_group_name
- (string) the name of the log group
Options
filter_name_prefix
- (string) the prefix to matchnext_token
- (string) the token for the next set of items to return (received from previous call)limit
- (integer) the maximum number of items returned (default is 50)
disassociate_kms_key(log_group_name)
View Sourcedisassociate_kms_key(binary()) :: ExAws.Operation.JSON.t()
Disassociates the associated KMS key from the specified log group.
Required
log_group_name
- (string) the name of the log group
filter_log_events(log_group_name_or_id, opts \\ [])
View Sourcefilter_log_events(binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Lists log events from the specified log group.
Required
log_group_name_or_id
- (string) the name or ARN of the log group
Options
log_stream_names
- (list) filters the results to only logs from the log streams in this list.log_stream_name_prefix
- (string) filters the results to include only events from log streams that have names starting with this prefix.
Note
If you specify a value for both log_stream_names and log-stream-name-prefix, the action returns an InvalidParameterException error.
start_time
- (long) the start of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTCend_time
- the end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTCfilter_pattern
- the filter pattern to useunmask
- specify true to display the log event fields with all sensitive data unmasked and visible. The default is false .next_token
- (string) the token for the next set of items to return (received from previous call)limit
- (integer) the maximum number of items returned (default is 50)
get_data_protection_policy(log_group_identifier)
View Sourceget_data_protection_policy(binary()) :: ExAws.Operation.JSON.t()
Returns information about a log group data protection policy.
Required
log_group_identifier
- (string) the name or ARN of the log group that contains the data protection policy that you want to see
get_log_events(log_group_name_or_id, log_stream_name, opts \\ [])
View Sourceget_log_events(binary(), binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Lists log events from the specified log stream.
Required
log_group_name_or_id
- (string) the name or ARN of the log grouplog_stream_name
- (string) the name of the log stream
Options
start_time
- (long) the start of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTCend_time
- (long) the end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTCnext_token
- (string) the token for the next set of items to returnlimit
- (integer) the maximum number of log events returnedstart_from_head
- (boolean_ if the value is true, the earliest log events are returned firstunmask
- (boolean) specify true to display the log event fields with all sensitive data unmasked and visible
get_log_group_fields(log_group_name_or_id, opts \\ [])
View Sourceget_log_group_fields(binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Returns a list of the fields that are included in log events in the specified log group.
Required
log_group_name_or_id
- (string) the name or ARN of the log group
Options
time
- (long) the time to set as the center of the query. If you specify time , the 15 minutes before this time are queries. If you omit time , the 8 minutes before and 8 minutes after this time are searched.
get_log_record(log_record_pointer, opts \\ [])
View Sourceget_log_record(binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Retrieves all of the fields and values of a single log event.
Required
log_record_pointer
- (string) the pointer corresponding to the log event record you want to retrieve
Options
unmask
- (boolean) specify true to display the log event fields with all sensitive data unmasked and visible
get_query_results(query_id)
View Sourceget_query_results(binary()) :: ExAws.Operation.JSON.t()
Returns the results from the specified query.
Required
query_id
- (string) the ID number of the query
list_tags_for_resource(resource_arn)
View Sourcelist_tags_for_resource(binary()) :: ExAws.Operation.JSON.t()
Displays the tags associated with a CloudWatch Logs resource.
Required
resource_arn
- (string) the ARN of the resource that you want to view tags for
put_data_protection_policy(log_group_identifier, policy_document)
View Sourceput_data_protection_policy(binary(), binary()) :: ExAws.Operation.JSON.t()
Creates a data protection policy for the specified log group.
Required
log_group_identifier
- (string) the log group name or log group ARNpolicy_document
- (string) the data protection policy, in JSON
put_destination(destination_name, target_arn, role_arn, opts \\ [])
View Sourceput_destination(binary(), binary(), binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Creates or updates a destination.
Required
destination_name
- (string) a name for the destinationtarget_arn
- (string) the ARN of an Amazon Kinesis stream to which to deliver matching log eventsrole_arn
- (string) the ARN of an IAM role that grants CloudWatch Logs permissions to call the Amazon KinesisPutRecord
operation on the destination stream
Options
tags
- (map) an optional list of key-value pairs to associate with the resource
put_destination_policy(destination_name, access_policy, opts \\ [])
View Sourceput_destination_policy(binary(), binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Creates or updates an access policy associated with an existing destination.
Required
destination_name
- (string) a name for an existing destinationaccess_policy
- (string) an IAM policy document that authorizes cross-account users to deliver their log events to the associated destination
Options
force_update
- (boolean) specify true if you are updating an existing destination policy to grant permission to an organization ID instead of granting permission to individual AWS accounts. If you omit this parameter, the default of false is used.
put_log_events(log_group_name, log_stream_name, log_events, opts \\ [])
View Sourceput_log_events(binary(), binary(), binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Uploads a batch of log events to the specified log stream.
Required
log_group_name
- (string) the name of the log grouplog_stream_name
- (string) the name of the log streamlog_events
- (list) the log events (each one a map of shape %{"timestamp" => long(), "message" => binary()})
Options
sequence_token
- (string) the sequence token obtained from the response of the previousput_log_events/4
call
put_metric_filter(log_group_name, filter_name, filter_pattern, metric_transformations)
View Sourceput_metric_filter(binary(), binary(), binary(), [metric_transformation()]) :: ExAws.Operation.JSON.t()
Creates or updates a metric filter and associates it with the specified log group.
Required
log_group_name
- (string) the name of the log groupfilter_name
- (string) a name for the metric filterfilter_pattern
- (string) a filter pattern for extracting metric data out of ingested log eventsmetric_transformations
- (list) a list of maps that defines how metric data gets emitted
put_query_definition(name, query_string, opts \\ [])
View Sourceput_query_definition(binary(), binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Creates or updates a query definition for CloudWatch Logs Insights.
Required
name
- (string) a name for the query definitionquery_string
- (string) the query string to use for this definition
Options
query_definition_id
- (string) if you are updating a query definition, use this parameter to specify the ID of the query definition that you want to updatelog_group_names
- (list) the specific log groups to include as part of your query definition
See AWS API Documentation See CloudWatch Logs Insights query syntax
put_resource_policy(policy_name, policy_document)
View Sourceput_resource_policy(binary(), binary()) :: ExAws.Operation.JSON.t()
Creates or updates a resource policy allowing other Amazon Web Services services to put log events to this account, such as Amazon Route 53.
Required
policy_name
- (string) name of the new policypolicy_document
- (string) details of the new policy, including the identity of the principal that is enabled to put logs to this account, formatted as a JSON string
put_retention_policy(log_group_name, retention_in_days)
View Sourceput_retention_policy(binary(), binary()) :: ExAws.Operation.JSON.t()
Sets the retention of the specified log group.
Required
log_group_name
- (string) the name of the log groupretention_in_days
- (integer) the number of days to retain the log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, and 3653.
put_subscription_filter(log_group_name, filter_name, filter_pattern, destination_arn, opts \\ [])
View SourceCreates or updates a subscription filter and associates it with the specified log group.
Required
log_group_name
- (string) the name of the log groupfilter_name
- (string) a name for the subscription filterfilter_pattern
- (string) a filter pattern for subscribing to a filtered stream of log eventsdestination_arn
- (string) the ARN of the destination to deliver matching log events to
Options
role_arn
- (string) the ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the destination streamdistribution
- (string) the method used to distribute log data to the destination; one ofRandom
orByLogStream
start_query(start_time, end_time, query_string, opts \\ [])
View Sourcestart_query(integer(), integer(), binary(), Keyword.t()) :: ExAws.Operation.JSON.t()
Schedules a query of a log group using CloudWatch Logs Insights.
Required
start_time
- (long) the beginning of the time range to queryend_time
- (long) the end of the time range to queryquery_string
- (string) the query string to useexactly one of (passed as option):
log_group_name
- (string) the log group on which to perform the querylog_group_names
- (list) the list of log groups to be queriedlog_group_identifiers
- (list) the list of log groups to query
Options
limit
- (integer) the maximum number of log events to return in the query
See AWS API Documentation See CloudWatch Logs Insights query syntax
stop_query(query_id)
View Sourcestop_query(binary()) :: ExAws.Operation.JSON.t()
Stops a CloudWatch Logs Insights query that is in progress.
Required
query_id
- (string) the ID number of the query to stop
tag_resource(resource_arn, tag_keys)
View Sourcetag_resource(binary(), map()) :: ExAws.Operation.JSON.t()
Assigns one or more tags (key-value pairs) to the specified CloudWatch Logs resource.
Required
resource_arn
- (string) the ARN of the resource that you're adding tags totag_keys
- (map) the list of key-value pairs to associate with the resource
test_metric_filter(filter_pattern, log_event_messages)
View Sourcetest_metric_filter(binary(), [binary()]) :: ExAws.Operation.JSON.t()
Tests the filter pattern of a metric filter against a sample of log event messages.
Required
filter_pattern
- (string) a symbolic description of how CloudWatch Logs should interpret the data in each log eventlog_event_messages
- (list) the log event messages to test
untag_resource(resource_arn, tag_keys)
View Sourceuntag_resource(binary(), [binary()]) :: ExAws.Operation.JSON.t()
Removes one or more tags from the specified resource.
Required
resource_arn
- (string) the ARN of the CloudWatch Logs resource that you're removing tags fromtag_keys
- (list) the list of tag keys to remove from the resource