I want to check the size of a log group in Amazon CloudWatch.
Resolution
Check the volume of log events in uncompressed bytes uploaded to CloudWatch Logs
To check the volume of log events in uncompressed bytes uploaded to CloudWatch Logs, use the IncomingBytes metric for a specific log group.
Complete the following steps:
- Open the CloudWatch console.
- In the navigation pane, choose All metrics.
- For each log group, complete the following tasks:
Choose the log's namespace.
Choose Logs, Log group metrics, and then select the individual IncomingBytes metrics.
Choose the Graphed metrics tab. Choose Sum for Statistic, and then choose 30 days for Period.
Choose the Graph options tab, and then choose Number.
At the top right of the graph, choose Custom, and then choose Absolute to set the time range. Select a start and end date that corresponds with the last 30 days.
Note: If you choose Relative instead of the Absolute option, then the graph returns incorrect data.
Check the volume of compressed log events of a log group
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version.
To check the volume of compressed log events of a log group, use either the CloudWatch console or the describe-log-groups command.
Use the CloudWatch console
- Open the Amazon CloudWatch console.
- In the navigation pane, choose Log groups.
- Choose the log group.
- The total size of the compressed log events is indicated under Stored bytes.
Use the AWS CLI
To describe a log group, run the following command:
Note: Replace example-log-group with the name of the required log group.
aws logs describe-log-groups --log-group-name-prefix example-log-group
Example output:
{
"logGroups": [
{
"storedBytes": 0,
"metricFilterCount": 0,
"creationTime": 1433189500783,
"logGroupName": example-log-group,
"retentionInDays": 5,
"arn": "arn:aws:logs:us-west-2:0123456789012:log-group:example-log-group:*"
}
]
}
Related information
Which log group is causing a sudden increase in my CloudWatch Logs bill?