Monitoring AWS IoT Events with Amazon CloudWatch
When you develop or debug an AWS IoT Events detector model, you need to know what AWS IoT Events is doing, and any errors it encounters. Amazon CloudWatch monitors your AWS resources and the applications you run on AWS in real time. With CloudWatch, you gain systemwide visibility into resource use, application performance, and operational health. Enable Amazon CloudWatch logging when developing AWS IoT Events detector models has information on how to enable CloudWatch logging for AWS IoT Events. To generate logs like the one shown below you must set the Level of verbosity to 'Debug' and provide one or more Debug Targets that is a Detector Model Name and an optional KeyValue.
The following example shows a CloudWatch DEBUG level log entry generated by AWS IoT Events.
{ "timestamp": "2019-03-15T15:56:29.412Z", "level": "DEBUG", "logMessage": "Summary of message evaluation", "context": "MessageEvaluation", "status": "Success", "messageId": "SensorAggregate_2th846h", "keyValue": "boiler_1", "detectorModelName": "BoilerAlarmDetector", "initialState": "high_temp_alarm", "initialVariables": { "high_temp_count": 1, "high_pressure_count": 1 }, "finalState": "no_alarm", "finalVariables": { "high_temp_count": 0, "high_pressure_count": 0 }, "message": "{ \"temp\": 34.9, \"pressure\": 84.5}", "messageType": "CUSTOMER_MESSAGE", "conditionEvaluationResults": [ { "result": "True", "eventName": "alarm_cleared", "state": "high_temp_alarm", "lifeCycle": "OnInput", "hasTransition": true }, { "result": "Skipped", "eventName": "alarm_escalated", "state": "high_temp_alarm", "lifeCycle": "OnInput", "hasTransition": true, "resultDetails": "Skipped due to transition from alarm_cleared event" }, { "result": "True", "eventName": "should_recall_technician", "state": "no_alarm", "lifeCycle": "OnEnter", "hasTransition": true } ] }