DEV Community

Deep Dive on Loop Filter as Metric Filter in Amazon CloudWatch

“ I have checked the documents of AWS for deep dive on loop filter as metric filter in amazon cloudwatch. Amazon cloudwatch makes it easy for metric filter and alarms. In terms of cost, the solution is cheaper and secure.”

Metrics are the fundamental concept in cloudwatch. A metric represents a time-ordered set of data points that are published to cloudwatch. Think of a metric as a variable to monitor and the data points as representing the values of that variable over time. For example, the cpu usage of a particular ec2 instance is one metric provided by amazon ec2. The data points themselves can come from any application or business activity from which you collect data.

By default, many AWS services provide metrics at no charge for resources. For a charge, you can also enable detailed monitoring for some resources, such as your amazon ec2 instance or publish your own application metrics. For custom metrics, you can add the data points in any order and at any rate you choose. You can retrieve statistics about those data points as an ordered set of time-series data.

In this post, you will experience the deep dive on loop filter as metric filter in amazon cloudwatch. Here I have uploaded the file in s3 bucket which api call logs stored in amazon cloudwatch via trace by cloudtrail. In the cloudwatch log group, added a metric filter and alarm with sns notification.

Architecture Overview


The architecture diagram shows the overall deployment architecture with data flow, amazon cloudwatch, sns, cloudtrail, s3 bucket.

Solution overview

The blog post consists of the following phases:

  1. Enable of Server Access Logging in S3 Bucket and Track Log Stream in CloudWatch Log Group
  2. Create of Loop Filter as Metric Filter on CloudWatch Log Group and Set of Alarm on Metric Filter

Phase 1: Enable of Server Access Logging in S3 Bucket and Track Log Stream in CloudWatch Log Group

  1. Open the Amazon S3 console, goto properties tab and check for server access logging option. Enable the server access logging option with a set of server logs destination s3 bucket. Upload a file in testdeta bucket to get its api call log in cloudtrail as log stream of cloudwatch log group. Also we can set a sns topic and subscription for notification purpose.

Phase 2: Create of Loop Filter as Metric Filter on CloudWatch Log Group and Set of Alarm on Metric Filter

Clean-up

Amazon cloudwatch: log group, log stream and alarm, s3 bucket, cloudtrail, sns.

Pricing

I review the pricing and estimated cost of this example.

Cost of Amazon CloudWatch = $0.00
Amazon CloudWatch :
$0.00 per alarm metric month - first 10 alarm metrics for 0 Alarms = $0.00
$0.00 per metric-month - first 10 metrics for 0.001 metrics = $0.00
AmazonCloudWatch PutLogEvents :
First 5GB per month of log data ingested is free for 0.001GB = $0.00

Cost of CloudTrail = $0.00
AWS CloudTrail USE1-FreeEventsRecorded : 0.0 per free event recorded for 827 events = $0.00

Cost of Simple Storage Service = $0.01

Cost of Simple Notification Service = $0.00

Total Cost = $0.01

Summary

In this post, I showed “deep dive on loop filter as metric filter in amazon cloudwatch”.

For more details on Amazon CloudWatch, Checkout Get started Amazon CloudWatch, open the Amazon CloudWatch console. To learn more, read the Amazon CloudWatch documentation.

Thanks for reading!

Connect with me: Linkedin

Top comments (0)