Tails the logs for a CloudWatch Logs group

An AWS CLI command to tail a CloudWatch log group

Command that tails a CloudWatch Logs group directly into your terminal. Useful command to watch CloudWatch log groups without needing to go into the console. By default, the command returns logs from all associated CloudWatch Logs streams during the past ten minutes. Note that there is no guarantee for exact timestamp ordering of logs.

AWS CLI Command (You will need AWS CLI v2)

aws logs tail {LogGroupName} --follow --format json
                                


Example output with json format

2022-10-05T08:32:51+00:00 f525e7be-c42d-3f0d-a7c4-6a51d01da714
{
    "version": "0",
    "id": "daf8f653-560e-df19-c0d7-441cb55c414a",
    "detail-type": "UserCreated",
    "source": "com.mycompany.myapp",
    "account": "123456789123",
    "time": "2022-10-05T08:32:51Z",
    "region": "us-west-2",
    "resources": [
        "resource1",
        "resource2"
    ],
    "detail": {
        "key1": "value1",
        "key2": "value2"
    }
}
2022-10-05T08:33:05+00:00 c996a3cc-dd68-3aef-9fbb-6a2c7f8e4472
{
    "version": "0",
    "id": "3b256c05-8879-e7f5-94be-ce3bc7af68f4",
    "detail-type": "UserCreated",
    "source": "com.mycompany.myapp",
    "account": "123456789123",
    "time": "2022-10-05T08:33:05Z",
    "region": "us-west-2",
    "resources": [
        "resource1",
        "resource2"
    ],
    "detail": {
        "key1": "value1",
        "key2": "value2"
    }
}
                                


Created by:

David Boyne

David Boyne

Helping people learn about event-driven architectures and serverless

Follow on LinkedIn