Amazon Web Services (AWS) - List Cloudwatch Alarm Log Streams using the AWS CLI

by
Jeremy Canfield |
Updated: January 04 2025
| Amazon Web Services (AWS) articles
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
Cloudwatch alarms can be used to alert you when some conditiion is met, such as if an EC2 instance is unavailable due to high CPU or high memory usage.
The aws logs describe-log-groups command can be used to list the Cloudwatch Log Groups you have created.
aws logs describe-log-groups
Something like this should be returned.
{
"logGroups": [
{
"logGroupName": "foo_log_group",
"creationTime": 1596419418715,
"metricFilterCount": 0,
"arn": "arn:aws:logs:us-east-1:123456789012:log-group:foo_log_group:*",
"storedBytes": 897
},
{
"logGroupName": "bar_log_group",
"creationTime": 1596419769060,
"metricFilterCount": 0,
"arn": "arn:aws:logs:us-east-1:123456789012:log-group:bar_log_group:*",
"storedBytes": 956
}
]
}
Then the aws logs describe-log-streams command can be used to list the log streams in a log group.
aws logs describe-log-streams --log-group-name foo_log_group
Something like this should be returned.
{
"logStreams": [
{
"logStreamName": "foo_log_stream",
"creationTime": 1706669547681,
"firstEventTimestamp": 1706669548162,
"lastEventTimestamp": 1735964679396,
"lastIngestionTime": 1735964684048,
"uploadSequenceToken": "49039859615201301197984872076520224950847496552746230851",
"arn": "arn:aws:logs:us-east-1:123456789012:foo_log_group:my-logs:log-stream:foo_log_stream",
"storedBytes": 0
},
{
"logStreamName": "bar_log_stream",
"creationTime": 1706669493312,
"firstEventTimestamp": 1706669493719,
"lastEventTimestamp": 1735965441010,
"lastIngestionTime": 1735965445252,
"uploadSequenceToken": "49039859615202313011652175537622343285672894895059543185",
"arn": "arn:aws:logs:us-east-1:123456789012:foo_log_group:my-logs:log-stream:bar_log_stream",
"storedBytes": 0
}
]
}
Did you find this article helpful?
If so, consider buying me a coffee over at