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 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 type

metric_transformation()

View Source
metric_transformation() :: %{
  default_value: float(),
  dimensions: map(),
  metric_name: binary(),
  metric_namespace: binary(),
  metric_value: binary(),
  unit: binary()
}

Link to this section Functions

Link to this function

associate_kms_key(log_group_name, kms_key_id)

View Source
associate_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 group
  • kms_key_id - (string) the Amazon Resource Name (ARN) of the KMS key to use when encrypting log data

See AWS API Documentation

Link to this function

cancel_export_task(task_id)

View Source
cancel_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

See AWS API Documentation

Link to this function

create_export_task(log_group_name, from, to, destination, opts \\ [])

View Source
create_export_task(binary(), integer(), integer(), binary(), Keyword.t()) ::
  ExAws.Operation.JSON.t()

Creates 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 group
  • from - (long) the start time of the range for the request, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC
  • to - (long) the end time of the range for the request, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC
  • destination - (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 isexportedlogs` See AWS API Documentation
Link to this function

create_log_group(log_group_name, opts \\ [])

View Source
create_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
Link to this function

create_log_stream(log_group_name, log_stream_name)

View Source
create_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 group
  • log_stream_name - (string) the name of the log stream

See AWS API Documentation

Link to this function

delete_data_protection_policy(log_group_identifier)

View Source
delete_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

See AWS API Documentation

Link to this function

delete_destination(destination_name)

View Source
delete_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

See AWS API Documentation

Link to this function

delete_log_group(log_group_name)

View Source
delete_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

See AWS API Documentation

Link to this function

delete_log_stream(log_group_name, log_stream_name)

View Source
delete_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 group
  • log_stream_name - (string) the name of the log stream

See AWS API Documentation

Link to this function

delete_metric_filter(log_group_name, filter_name)

View Source
delete_metric_filter(binary(), binary()) :: ExAws.Operation.JSON.t()

Deletes the specified metric filter.

Required

  • log_group_name - (string) the name of the log group
  • filter_name - (string) the name of the metric filter.

See AWS API Documentation

Link to this function

delete_query_definition(query_definition_id)

View Source
delete_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

See AWS API Documentation

Link to this function

delete_resource_policy(policy_name)

View Source
delete_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

See AWS API Documentation

Link to this function

delete_retention_policy(log_group_name)

View Source
delete_retention_policy(binary()) :: ExAws.Operation.JSON.t()

Deletes the specified retention policy.

Required

  • log_group_name - (string) the name of the log group

See AWS API Documentation

Link to this function

delete_subscription_filter(log_group_name, filter_name)

View Source
delete_subscription_filter(binary(), binary()) :: ExAws.Operation.JSON.t()

Deletes the specified subscription filter.

Required

  • log_group_name - (string) the name of the log group
  • filter_name - (string) the name of the subscription filter

See AWS API Documentation

Link to this function

describe_destinations(opts \\ [])

View Source
describe_destinations(Keyword.t()) :: ExAws.Operation.JSON.t()

Lists all your destinations.

Options

  • destination_name_prefix - (string) the prefix to match
  • 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)

See AWS API Documentation

Link to this function

describe_export_tasks(opts \\ [])

View Source
describe_export_tasks(Keyword.t()) :: ExAws.Operation.JSON.t()

Lists the specified export tasks.

Options

  • task_id - (string) the ID of the export task
  • status_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)

See AWS API Documentation

Link to this function

describe_log_groups(opts \\ [])

View Source
describe_log_groups(Keyword.t()) :: ExAws.Operation.JSON.t()

Lists the specified log groups.

Options

  • account_identifiers - (list) when include_linked_accounts is set to True , use this parameter to specify the list of accounts to search
  • log_group_name_prefix - (string) the prefix to match
  • log_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 search
  • include_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 in account_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)

See AWS API Documentation

Link to this function

describe_log_streams(log_group_name_or_id, opts \\ [])

View Source
describe_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 match
  • order_by - (string) if the value is LogStreamName, the results are ordered by log stream name. If the value is LastEventTime, the results are ordered by the event time. The default value is LogStreamName.
  • 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)

See AWS API Documentation

Link to this function

describe_metric_filters(opts \\ [])

View Source
describe_metric_filters(Keyword.t()) :: ExAws.Operation.JSON.t()

Lists the specified metric filters.

Options

  • log_group_name - the name of the log group
  • filter_name_prefix - (string) the prefix to match
  • metric_name - filters results to include only those with the specified metric name. If you include this parameter in your request, you must also include the metric_namespace parameter
  • metric_namespace - filters results to include only those in the specified namespace. If you include this parameter in your request, you must also include the metric_name parameter
  • 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)

See AWS API Documentation

Link to this function

describe_queries(opts \\ [])

View Source
describe_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 group
  • status - (string) limits the returned queries to only those that have the specified status. Valid values are Cancelled, Complete, Failed, Running, and Scheduled.
  • 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
Link to this function

describe_query_definitions(opts \\ [])

View Source
describe_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 specify
  • max_results - (integer) limits the number of returned query definitions to the specified number
  • next_token - (string) the token for the next set of items to return. The token expires after 24 hours

See AWS API Documentation

Link to this function

describe_resource_policies(opts \\ [])

View Source
describe_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)

See AWS API Documentation

Link to this function

describe_subscription_filters(log_group_name, opts \\ [])

View Source
describe_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 match
  • 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)

See AWS API Documentation

Link to this function

disassociate_kms_key(log_group_name)

View Source
disassociate_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

See AWS API Documentation

Link to this function

filter_log_events(log_group_name_or_id, opts \\ [])

View Source
filter_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 UTC
  • end_time - the end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC
  • filter_pattern - the filter pattern to use
  • unmask - 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)

See AWS API Documentation

Link to this function

get_data_protection_policy(log_group_identifier)

View Source
get_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

See AWS API Documentation

Link to this function

get_log_events(log_group_name_or_id, log_stream_name, opts \\ [])

View Source
get_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 group
  • log_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 UTC
  • end_time - (long) the end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC
  • next_token - (string) the token for the next set of items to return
  • limit - (integer) the maximum number of log events returned
  • start_from_head - (boolean_ if the value is true, the earliest log events are returned first
  • unmask - (boolean) specify true to display the log event fields with all sensitive data unmasked and visible

See AWS API Documentation

Link to this function

get_log_group_fields(log_group_name_or_id, opts \\ [])

View Source
get_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.

See AWS API Documentation

Link to this function

get_log_record(log_record_pointer, opts \\ [])

View Source
get_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

See AWS API Documentation

Link to this function

get_query_results(query_id)

View Source
get_query_results(binary()) :: ExAws.Operation.JSON.t()

Returns the results from the specified query.

Required

  • query_id - (string) the ID number of the query

See AWS API Documentation

Link to this function

list_tags_for_resource(resource_arn)

View Source
list_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

See AWS API Documentation

Link to this function

put_data_protection_policy(log_group_identifier, policy_document)

View Source
put_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 ARN
  • policy_document - (string) the data protection policy, in JSON

See AWS API Documentation

Link to this function

put_destination(destination_name, target_arn, role_arn, opts \\ [])

View Source
put_destination(binary(), binary(), binary(), Keyword.t()) ::
  ExAws.Operation.JSON.t()

Creates or updates a destination.

Required

  • destination_name - (string) a name for the destination
  • target_arn - (string) the ARN of an Amazon Kinesis stream to which to deliver matching log events
  • role_arn - (string) the ARN of an IAM role that grants CloudWatch Logs permissions to call the Amazon Kinesis PutRecord operation on the destination stream

Options

  • tags - (map) an optional list of key-value pairs to associate with the resource

See AWS API Documentation

Link to this function

put_destination_policy(destination_name, access_policy, opts \\ [])

View Source
put_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 destination
  • access_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.

See AWS API Documentation

Link to this function

put_log_events(log_group_name, log_stream_name, log_events, opts \\ [])

View Source
put_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 group
  • log_stream_name - (string) the name of the log stream
  • log_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 previous put_log_events/4 call

See AWS API Documentation

Link to this function

put_metric_filter(log_group_name, filter_name, filter_pattern, metric_transformations)

View Source
put_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 group
  • filter_name - (string) a name for the metric filter
  • filter_pattern - (string) a filter pattern for extracting metric data out of ingested log events
  • metric_transformations - (list) a list of maps that defines how metric data gets emitted

See AWS API Documentation

Link to this function

put_query_definition(name, query_string, opts \\ [])

View Source
put_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 definition
  • query_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 update
  • log_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

Link to this function

put_resource_policy(policy_name, policy_document)

View Source
put_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 policy
  • policy_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

See AWS API Documentation

Link to this function

put_retention_policy(log_group_name, retention_in_days)

View Source
put_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 group
  • retention_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.

See AWS API Documentation

Link to this function

put_subscription_filter(log_group_name, filter_name, filter_pattern, destination_arn, opts \\ [])

View Source
put_subscription_filter(binary(), binary(), binary(), binary(), Keyword.t()) ::
  ExAws.Operation.JSON.t()

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

Required

  • log_group_name - (string) the name of the log group
  • filter_name - (string) a name for the subscription filter
  • filter_pattern - (string) a filter pattern for subscribing to a filtered stream of log events
  • destination_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 stream
  • distribution - (string) the method used to distribute log data to the destination; one of Random or ByLogStream

See AWS API Documentation

Link to this function

start_query(start_time, end_time, query_string, opts \\ [])

View Source
start_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 query
  • end_time - (long) the end of the time range to query
  • query_string - (string) the query string to use
  • exactly one of (passed as option):

    • log_group_name - (string) the log group on which to perform the query
    • log_group_names - (list) the list of log groups to be queried
    • log_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

Stops a CloudWatch Logs Insights query that is in progress.

Required

  • query_id - (string) the ID number of the query to stop

See AWS API Documentation

Link to this function

tag_resource(resource_arn, tag_keys)

View Source
tag_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 to
  • tag_keys - (map) the list of key-value pairs to associate with the resource

See AWS API Documentation

Link to this function

test_metric_filter(filter_pattern, log_event_messages)

View Source
test_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 event
  • log_event_messages - (list) the log event messages to test

See AWS API Documentation

Link to this function

untag_resource(resource_arn, tag_keys)

View Source
untag_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 from
  • tag_keys - (list) the list of tag keys to remove from the resource

See AWS API Documentation