Skip to content

Latest commit

 

History

History

cloudwatch-log-group

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

cloudwatch-log-group

This module creates following resources.

  • aws_cloudwatch_log_group
  • aws_cloudwatch_log_stream (optional)
  • aws_cloudwatch_log_metric_filter (optional)

Requirements

Name Version
terraform >= 1.5
aws >= 4.60

Providers

Name Version
aws 5.19.0

Modules

Name Source Version
resource_group tedilabs/misc/aws//modules/resource-group ~> 0.10.0

Resources

Name Type
aws_cloudwatch_log_group.this resource
aws_cloudwatch_log_metric_filter.this resource
aws_cloudwatch_log_stream.this resource

Inputs

Name Description Type Default Required
name (Required) The name of the CloudWatch log group. string n/a yes
encryption_kms_key (Optional) The ARN of the KMS Key to use when encrypting log data. Please note, after the AWS KMS CMK is disassociated from the log group, AWS CloudWatch Logs stops encrypting newly ingested data for the log group. All previously ingested data remains encrypted, and AWS CloudWatch Logs requires permissions for the CMK whenever the encrypted data is requested. string null no
metric_filters (Required) A list of metric filters for CloudWatch log group. Log events that match the pattern you define are recorded to the metric that you specify. You can graph the metric and set alarms to notify you. Each item of metric_filters as defined below.
(Required) name - A name for the metric filter.
(Optional) pattern - A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events. Filter patterns are case sensitive. Defaults to " " (match everything in your log events).
(Required) metric - A configuration to define how metric data gets emitted. metric as defined below.
(Required) namespace - The destination namespace of the CloudWatch metric. Namespace let you group similar metrics. Can be up to 255 characters long; all characters are valid except for colon(:), asterisk(*), dollar($), and space( ).
(Required) name - The name of the CloudWatch metric to which the monitored log information should be published. Must be unique within the namespace.
(Required) value - What to publish to the metric. For example, if you're counting the occurrences of a particular term like "Error", the value will be 1 for each occurrence. Alternatively, enter a token, such as $size. This increments the metric by the value of the number in the size field for every log event that contains a size field.
(Optional) default_value - The value to emit when a filter pattern does not match a log event. Conflicts with dimensions.
(Optional) dimensions - A map of fields to use as dimensions for the metric. Up to 3 dimensions are allowed. Conflicts with default_value.
(Optional) unit - The unit to assign to the metric. Defaults to None.
list(object({
name = string
pattern = optional(string, "" "")
metric = object({
namespace = string
name = string
value = string
default_value = optional(string)
dimensions = optional(map(string))
unit = optional(string, "None")
})
}))
[] no
module_tags_enabled (Optional) Whether to create AWS Resource Tags for the module informations. bool true no
resource_group_description (Optional) The description of Resource Group. string "Managed by Terraform." no
resource_group_enabled (Optional) Whether to create Resource Group to find and group AWS resources which are created by this module. bool true no
resource_group_name (Optional) The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with AWS or aws. string "" no
retention_in_days (Optional) Specify the number of days to retain log events in the log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653, and 0. If you select 0, the events in the log group are always retained and never expire. Default to 90 days. number 90 no
skip_destroy (Optional) Set to true if you do not wish the log group to be deleted at destroy time, and instead just remove the log group from the Terraform state. Defaults to false. bool false no
streams (Optional) A list of log streams for the CloudWatch log group. set(string) [] no
tags (Optional) A map of tags to add to all resources. map(string) {} no

Outputs

Name Description
arn The ARN of the CloudWatch log group.
encryption_kms_key The ARN of the KMS Key for log data encryption.
id The ID of the CloudWatch log group.
metric_filters The list of metric filters for the log group.
name The name of CloudWatch log group.
retention_in_days The number of days to retain log events in the log group.
streams The list of log streams for the log group.