0
0
AWScloud~10 mins

CloudWatch Logs in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a CloudWatch Logs log group using AWS CLI.

AWS
aws logs create-log-group --log-group-name [1]
Drag options to blanks, or click blank then click option'
AMyAppLogGroup
BMyAppStream
CMyAppAlarm
DMyAppMetricFilter
Attempts:
3 left
💡 Hint
Common Mistakes
Using a log stream name instead of a log group name.
Confusing metric filters or alarms with log groups.
2fill in blank
medium

Complete the code to put a log event into a CloudWatch Logs log stream using AWS CLI.

AWS
aws logs put-log-events --log-group-name MyAppLogGroup --log-stream-name MyAppStream --log-events '[{"timestamp":[1],"message":"User login successful"}]'
Drag options to blanks, or click blank then click option'
A01/01/2023
B2023-01-01T12:00:00Z
C1672531200000
D12:00:00
Attempts:
3 left
💡 Hint
Common Mistakes
Using ISO date strings instead of milliseconds.
Using human-readable date formats.
3fill in blank
hard

Fix the error in the AWS CLI command to describe log streams for a log group.

AWS
aws logs describe-log-streams --log-group-name [1]
Drag options to blanks, or click blank then click option'
AMyAppStream
BMyAppAlarm
CMyAppMetricFilter
DMyAppLogGroup
Attempts:
3 left
💡 Hint
Common Mistakes
Using a log stream name instead of a log group name.
Confusing metric filters or alarms with log groups.
4fill in blank
hard

Fill both blanks to create a metric filter for error logs in a log group.

AWS
aws logs put-metric-filter --log-group-name [1] --filter-name ErrorFilter --metric-transformations '[{"metricName":"ErrorCount","metricNamespace":"MyApp","metricValue":[2]]' --filter-pattern "ERROR"
Drag options to blanks, or click blank then click option'
AMyAppLogGroup
B1
C0
DErrorStream
Attempts:
3 left
💡 Hint
Common Mistakes
Using a log stream name instead of a log group name.
Setting metric value to zero which would not count events.
5fill in blank
hard

Fill all three blanks to create an alarm based on the metric filter for error count.

AWS
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
Drag options to blanks, or click blank then click option'
AErrorAlarm
BErrorCount
CGreaterThanOrEqualToThreshold
DLessThanThreshold
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong metric name.
Using a comparison operator that triggers on low values.