From 6e5e2aa82a8cfaf45f2ebcf0299fb1d3fd56b868 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Sun, 16 Feb 2025 10:54:57 +0100 Subject: [PATCH] chore(kb/aws/cloudwatch): give some metric queries of interest --- knowledge base/cloud computing/aws/README.md | 71 +++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/knowledge base/cloud computing/aws/README.md b/knowledge base/cloud computing/aws/README.md index 0fd50fb..ce8b3b2 100644 --- a/knowledge base/cloud computing/aws/README.md +++ b/knowledge base/cloud computing/aws/README.md @@ -123,7 +123,8 @@ New tags might take 24 or 48 hours to appear there. Observability service. with functions for logging, monitoring and alerting. -_Metrics_ are whatever needs to be monitored (e.g. CPU usage). _Data points_ are the values of a metric over time. +_Metrics_ are whatever needs to be monitored (e.g. CPU usage).
+_Data points_ are the values of a metric over time.
_Namespaces_ are containers for metrics. Metrics only exist in the region in which they are created. @@ -132,6 +133,64 @@ Metrics only exist in the region in which they are created. metrics to CloudWatch with no charge.
This feature is automatically enabled by default when one starts using one of these services. +API calls for CloudWatch are paid. + +It's best practice to **distribute** the `ListMetrics` call to avoid throttling.
+The default limit for `ListMetrics` is 25 transactions per second. + +The [CloudWatch console] offers some default good queries. + +
+ Queries of interest + +| What | Section | Tab | How to visualize | +| ------------------------------------ | ----------- | --------------- | ----------------------------------------------------- | +| [Top 10 log groups by written bytes] | All Metrics | Graphed metrics | Add Query > Logs > Top 10 log groups by written bytes | + +
+ Get a dashboard of how much data a small set of log groups ingested in the last 30 days + +> This graph works only with the _Absolute_ time period option.
+> Should you choose _Relative_, the graph returns incorrect data. + +1. [CloudWatch console] > _All metrics_ (navigation pane on the left). +1. Choose _Logs_, _Log group metrics_. +1. Select the individual `IncomingBytes` metrics of each log group of interest. +1. Choose the _Graphed metrics_ tab. +1. For each metric: + - Change `Statistic` to `Sum`. + - Change `Period` to `30 Days`. +1. Choose the _Graph options_ tab. +1. Choose the _Number_ option group. +1. At the top right of the graph, choose _Custom_ as the time range. +1. Choose _Absolute_. +1. Select the last 30 days as start and end date. + +
+ +
+ Get a dashboard of how much data all log groups ingested in the last 30 days + +> This graph works only with the _Absolute_ time period option.
+> Should you choose _Relative_, the graph returns incorrect data. + +1. [CloudWatch console] > _All metrics_ (navigation pane on the left). +1. Choose the _Graphed metrics_ tab. +1. From the _Add math_ dropdown list, choose _Start with an empty expression_. +1. Paste this as math expression: + + ```plaintext + SORT(REMOVE_EMPTY(SEARCH('{AWS/Logs,LogGroupName} MetricName="IncomingBytes"', 'Sum', 2592000)),SUM, DESC) + ``` + +1. At the top right of the graph, choose _Custom_ as the time range. +1. Choose _Absolute_. +1. Select the last 30 days as start and end date. + +
+ +
+ ### Config Compliance service for assessing and auditing AWS resources. @@ -274,8 +333,14 @@ Refer [IAM]. ## Costs +One pays for data transfer between instances and services in the **same region** but **different availability +zone**.
See [Understanding data transfer charges]. +One pays for sending logs to [CloudWatch].
+Refer [Which log group is causing a sudden increase in my CloudWatch Logs bill?] to get an idea of what changed in some +time frame. + ## Savings plans Refer [Savings Plans user guide]. @@ -486,6 +551,7 @@ machine if not. - [Boto3 resources] - [Boto3 sessions] - [Boto3 paginators] +- [Which log group is causing a sudden increase in my CloudWatch Logs bill?] [a guide to tagging resources in aws]: https://medium.com/@staxmarketing/a-guide-to-tagging-resources-in-aws-8f4311afeb46