Installation Error Alarm

1.  Open the CloudWatch dialog

2.  Click on Logs, select the cfn-logs in the Log Groups and then click Create Metric Filter.

3.  Use a space delimited Filter Pattern by surrounding the pattern in square brackets – [].
To detect errors when executing CloudFormation scripts you need to search for ERROR in the first field and Command in the second field, the remaining fields are not relevant so use ellipsis (…) to indicate that. If the sample log data contains your error log data you can click Test Pattern to test it. Otherwise just click Assign Metric.

4.  Change the default Filter Name if you wish and then enter the metric Namespace and Metric Name as indicated below...

5.  The following result will be displayed with the text that's highlighted in red. Click Create Alarm.

6.  Enter a Name and Description. This description is "Error has occurred creating or updating the stack". The alarm needs to be displayed as soon as possible so it is set to a single error line in one period and the period is 1 minute. Then click on New List if you haven't already got a notification list.

7.  Enter the name of your topic like LansaAdmin and enter some email addresses separated by commas. Note that you may enlarge the email list by dragging the bottom right hand corner as indicated by the arrow. Then click Create Alarm.

8.  This alarm is now ready to send an email to the list you created whenever there is an installation error in the LANSA Stack. There is one issue: the alarm will be listed under INSUFFICIENT. This is because the filter rarely matches any data at all. Only when there is an error. So another filter needs to be created that matches on all data but uses a Metric Value of zero so it does not affect the statistics.

9.  So, create another filter on the cfn-logs Log Group and enter no pattern. Just click Assign Metric.

10. Enter the same Metric Namespace and Metric Name as for the previous filter, but set the Metric Value to 0.

11. The cfn logs update about once per minute and hence will always have data points.