Complete the code to create a CloudWatch Logs log group using AWS CLI.
aws logs create-log-group --log-group-name [1]The create-log-group command requires the log group name. Here, MyAppLogGroup is the correct name for the log group.
Complete the code to put a log event into a CloudWatch Logs log stream using AWS CLI.
aws logs put-log-events --log-group-name MyAppLogGroup --log-stream-name MyAppStream --log-events '[{"timestamp":[1],"message":"User login successful"}]'
The timestamp value must be in milliseconds since Unix epoch. The value 1672531200000 represents a valid timestamp.
Fix the error in the AWS CLI command to describe log streams for a log group.
aws logs describe-log-streams --log-group-name [1]The describe-log-streams command requires the log group name, not the log stream name.
Fill both blanks to create a metric filter for error logs in a log group.
aws logs put-metric-filter --log-group-name [1] --filter-name ErrorFilter --metric-transformations '[{"metricName":"ErrorCount","metricNamespace":"MyApp","metricValue":[2]]' --filter-pattern "ERROR"
The metric filter must be created on the log group MyAppLogGroup and the metric value for each matching event is 1.
Fill all three blanks to create an alarm based on the metric filter for error count.
aws cloudwatch put-metric-alarm --alarm-name [1] --metric-name [2] --namespace MyApp --statistic Sum --period 60 --threshold 5 --comparison-operator [3] --evaluation-periods 1 --alarm-actions arn:aws:sns:us-east-1:123456789012:NotifyMe
The alarm is named ErrorAlarm, monitors the metric ErrorCount, and triggers when the sum is greater than or equal to the threshold.