Traditional application development emits events in the form of logs. Use CloudWatch we can generate metrics from our logs using pattern matching. By generating metrics based on observed log messages we can increase the value of our CloudWatch logs by providing visualizations of the metric data through dashboard, and providing alerts when metrics breach baseline thresholds. Using the AWS CLI or API you can publish your own custom metrics.
Create a Confidence metric
Monitoring for Business Outcomes Titus Grone wants to know that ExampleCorp is delighting our customers. Feedback from the customer indicates that accuracy of items identified in the upload images is the greatest source of satisfaction when it works well, and frustration when it does not. Focus groups indicate that it is better to not have misidentified (low confidence) objects.
He wants to track the image recognition confidence levels as a measure of how accurate the ExampleCorp application is performing. He will use this information to help determine where to focus development efforts.
4.1 Create the Log Metric
[logType, myTimestamp, severity, delim1, delim2, type, action, for, Image, imgNum, Name, imgTags, Confidence, cValue]
- To test your filter pattern, for **Select Log Data to Test**, select the log group to test the metric filter against, and then choose Test Pattern. - Under **Results**, CloudWatch Logs displays a message showing how many occurrences of the filter pattern were found in the log file. To see detailed results, click Show test results. - Choose **Next**
3. On the Create Metric Filter and Assign a Metric screen, - For Filter Name type confidenceLevels - Under Metric Details, for Metric Namespace, type ApplicationLogMetrics - For Metric Name, type cValue - For Metric Value choose $cValue. - Leave the Default Value undefined, and then choose Next. - Review the metric filter, and then choose Create metric Filter.
4.2 Review the resulting metrics
4.3 Create a dashboard