breezy-laptop-42679
09/05/2022, 4:10 PMbreezy-airplane-94478
09/09/2022, 3:56 AMbreezy-laptop-42679
09/09/2022, 4:13 AMbreezy-airplane-94478
09/09/2022, 6:24 PM"*"
like a wildcard.const testEmail = '<mailto:test@gmail.com|test@gmail.com>';
const cloudWatchLogGroup = new aws.cloudwatch.LogGroup("cloudWatchLogGroup", {
retentionInDays: 0, // never expire
});
const testTopic = new aws.sns.Topic("testTopic", {
displayName: "test Alarm",
});
const testTopicSubscription = new aws.sns.TopicSubscription("testTopicSubscription", {
endpoint: testEmail,
protocol: "email",
topic: testTopic.id,
});
const testMetricFilter = new aws.cloudwatch.LogMetricFilter("testMetricFilter", {
pattern: `{($.eventName=ConsoleLogin) && ($.errorMessage="Failed authentication")}`,
logGroupName: cloudWatchLogGroup.name,
metricTransformation:
{
name: "AWS Test Change Metric",
namespace: "Test/TestMetrics",
value: "1",
},
});
const testAlarm = new aws.cloudwatch.MetricAlarm("testAlarm", {
name: "Test Metric Alarm",
comparisonOperator: "GreaterThanOrEqualToThreshold",
evaluationPeriods: 1,
metricName: testMetricFilter.metricTransformation.name,
namespace: testMetricFilter.metricTransformation.namespace,
period: 5 * 60,
statistic: "Average",
threshold: 1,
treatMissingData: "missing",
alarmActions: [testTopic.arn],
alarmDescription: "Monitoring Test Alarm",
});
breezy-laptop-42679
09/12/2022, 4:52 AM