AWS CloudWatch

1. Introduction

TBD


2. Logs Insights

Sample query:

fields @timestamp, @message

| filter @message like /From: caronte@uoc.edu/

| sort @timestamp desc

| limit 20

3. Metrics Insights

Query your metrics with CloudWatch Metrics Insights:

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/query_with_cloudwatch-metrics-insights.html


Syntax:

SELECT FUNCTION(metricName)

FROM namespace | SCHEMA(...)

[ WHERE labelKey OPERATOR labelValue [AND ... ] ]

[ GROUP BY labelKey [ , ... ] ]

[ ORDER BY FUNCTION() [ DESC | ASC ] ]

[ LIMIT number ]


4. Custom metrics

Publishing custom metrics

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html


4.1. Dimensions

A dimension further clarifies what the metric is and what data it stores. You can have up to 10 dimensions in one metric, and each dimension is defined by a name and value pair.


4.2. Sample putMetricData

putMetricData() Node.js asynchronous call example:

https://stackoverflow.com/a/59544260/1323562