Bootstrap FreeKB - Amazon Web Services (AWS) - List Cloudwatch Alarm Log Groups using the AWS CLI
Amazon Web Services (AWS) - List Cloudwatch Alarm Log Groups using the AWS CLI

Updated:   |  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

 

And here is an example of how to limit the output using the --query option.

aws logs describe-log-groups --query 'logGroups[?logGroupName==`foo_log_group`]'

 

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
        }
    ]
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter f914aa in the box below so that we can be sure you are a human.