Monitoring and events for AWS IoT Core for Amazon Sidewalk - AWS IoT Core

Monitoring and events for AWS IoT Core for Amazon Sidewalk

You can configure events and use CloudWatch Logs to monitor your Sidewalk devices and troubleshoot any issues.

Events for Sidewalk devices

Use AWS IoT Core for Amazon Sidewalk to publish messages that notify you of events such as when the Sidewalk devices in your account have been provisioned or registered. The events are published over MQTT with a JSON payload whose content depends on the type of event.

Event types for Sidewalk devices

Events for Sidewalk resources include:

  • Device registration state events

    These events publish notifications when there's a change in the device registration state, such as when a Sidewalk device has been provisioned or registered.

  • Proximity events

    These events publish notifications when a beacon is received from your Sidewalk device. Beacons are sent at regular intervals when your Sidewalk device approaches Amazon Sidewalk.

  • Message delivery status events

    These events publish notifications about the status of messages that are exchanged between AWS IoT Core for Amazon Sidewalk and the Sidewalk device. For example it will publish an event to indicate when a message failed to deliver even though the SendDataToWirelessDevice API returns a message ID.

Enable events for Sidewalk devices

To receive events, your device must use an appropriate policy that allows it to connect to the AWS IoT device gateway and subscribe to MQTT event topics, as shown in the following example.

{ "Version":"2012-10-17", "Statement":[{ "Effect":"Allow", "Action":[ "iot:Subscribe", "iot:Receive" ], "Resource":[ "arn:aws:iotwireless:region:account:/$aws/iotwireless/events/join/*", "arn:aws:iotwireless:region:account:/$aws/iotwireless/events/connection_status/*", "arn:aws:iotwireless:region:account:/$aws/iotwireless/events/device_registration_state/*", "arn:aws:iotwireless:region:account:/$aws/iotwireless/events/proximity/*", "arn:aws:iotwireless:region:account:/$aws/iotwireless/events/message_delivery_status/*" ] }] }

You can enable events using the AWS IoT Core for Amazon Sidewalk API, AWS CLI, or the AWS Management Console. To configure events for all Sidewalk devices, use the UpdateEventConfigurationByResourceTypes API or the update-event-configuration-by-resource-types CLI command.

aws iotwireless update-event-configuration-by-resource-types \ --device-registration-state Sidewalk={WirelessDeviceEventTopic="Enabled"}

To configure events for individual devices, use the UpdateResourceEventConfiguration API or the update-resource-event-configuration CLI command.

aws iotwireless update-resource-event-configuration --identifier-type WirelessDeviceID \ --identifer "1ffd32c8-8130-4194-96df-622f072a315f" \ --message-delivery-status Sidewalk={WirelessDeviceIdEventTopic="Enabled"}

For more information about configuring events, see Sidewalk events.

Monitoring of Sidewalk devices

You can monitor your Sidewalk devices and applications that run in real time by using Amazon CloudWatch. Use CloudWatch to collect and track metrics, view logs that contain information about the status of your Sidewalk devices, filter the logs to view only errors, or obtain useful insights.

When using Amazon CloudWatch, first configure a logging role and then use log metrics or CloudWatch Insights to monitor your devices. Any error that occurs will be logged and sent to your CloudWatch log group. You can then learn more about the error and troubleshoot issues to resolve them.

The following steps show you how to log and monitor your Sidewalk devices:

  1. Create a logging role to log your Sidewalk devices, as shown in the following example policy. For more information, see Create logging role and policy for AWS IoT Wireless.

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "iotwireless.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": {} } ] }
  2. To obtain less verbose logs such as to view only error information, configure logging to logs. For more information, see Configure logging for AWS IoT Wireless resources.

  3. Monitor your Sidewalk devices by viewing the logs in the CloudWatch Logs console and create simple filters and view log entries in the Logs groups. For more information, see View CloudWatch AWS IoT Wireless log entries.

  4. Create advanced filter expressions depending on the logging information that you want to obtain, and go to CloudWatch Insights to filter the log queries and obtain additional insights. For more information, see View CloudWatch Insights to filter logs for AWS IoT Wireless.

For detailed instructions, see Monitoring and logging for AWS IoT Wireless.