Troubleshooting an Amazon IoT SiteWise rule action
To troubleshoot your Amazon IoT SiteWise rule action in Amazon IoT Core, you can do one of the following procedures:
-
Configure CloudWatch Logs
-
Configure a republish error action for your rule
Then, compare the error messages with the errors in this topic to troubleshoot your issue.
Configuring Amazon IoT Core logs
You can configure Amazon IoT to log various levels of information to CloudWatch Logs.
To configure and access CloudWatch Logs
-
To configure logging for Amazon IoT Core, see Monitoring with CloudWatch Logs in the Amazon IoT Developer Guide.
-
Navigate to the CloudWatch console
. -
In the navigation pane, choose Log groups.
-
Choose the AWSIotLogs group.
-
Choose a recent log stream. By default, CloudWatch displays the most recent log stream first.
-
Choose a log entry to expand the log message. Your log entry might look like the following screenshot.
-
Compare the error messages with the errors in this topic to troubleshoot your issue.
Configuring a republish error action
You can configure an error action on your rule to handle error messages. In this procedure, you configure the republish rule action as an error action to view error messages in the MQTT test client.
The republish error action outputs only the equivalent of ERROR
level
logs. If you want more verbose logs, you must configure
CloudWatch Logs.
To add a republish error action to a rule
-
Navigate to the Amazon IoT console
. -
In the left navigation pane, choose Act and then choose Rules.
-
Choose your rule.
-
Under Error action, choose Add action.
-
Choose Republish a message to an Amazon IoT topic.
-
Choose Configure action at the bottom of the page.
-
In Topic, enter a unique topic (for example,
sitewise/windfarm/rule/error
). Amazon IoT Core will republish error messages to this topic. -
Choose Select to grant Amazon IoT Core access to perform the error action.
-
Choose Select next to the role that you created for the rule.
-
Choose Update Role to add the additional permissions to the role.
-
Choose Add action.
Your rule's error action should look similar to the following screenshot.
-
Choose the back arrow in the upper left of the console to return to the Amazon IoT console home.
After you set up the republish error action, you can view the error messages in the MQTT test client in Amazon IoT Core.
In the following procedure, you subscribe to the error topic in the MQTT test client. In the MQTT test client, you can receive your rule's error messages to troubleshoot the issue.
To subscribe to the error action topic
-
Navigate to the Amazon IoT console
. -
In the left navigation page, choose Test to open the MQTT test client.
-
In the Subscription topic field, enter the error topic that you configured earlier (for example,
sitewise/windfarm/rule/error
) and choose Subscribe to topic. -
Watch for error messages to appear and then expand the
failures
array in any error message.Next, compare the error messages with the errors in this topic to troubleshoot your issue.
Troubleshooting issues
Use the following information to troubleshoot rule issues.
Issues
- Error: Member must be within 604800 seconds before and 300 seconds after the current timestamp
- Error: Property value does not match data type <type>
- Error: User: <role-arn> is not authorized to perform: iotsitewise:BatchPutAssetPropertyValue on resource
- Error: iot.amazonaws.com is unable to perform: sts:AssumeRole on resource: <role-arn>
- Info: No requests were sent. PutAssetPropertyValueEntries was empty after performing substitution templates.
Error: Member must be within 604800 seconds before and 300 seconds after the current timestamp
Your timestamp is older than 7 days or newer than 5 minutes, compared to current Unix epoch time. Try the following:
-
Check that your timestamp is in Unix epoch (UTC) time. If you provide a timestamp with a different timezone, you receive this error.
-
Check that your timestamp is in seconds. Amazon IoT SiteWise expects timestamps split into time in seconds (in Unix epoch time) and offset in nanoseconds.
-
Check that you're uploading data that is timestamped no later than 7 days in the past.
Error: Property value does not match data type <type>
An entry in your rule action has a different data type than the target asset property.
For example, your target asset property is a DOUBLE
and your selected data
type is Integer or you passed the value in integerValue
.
Try the following:
-
If you configure the rule from the Amazon IoT console, check that you chose the correct Data type for each entry.
-
If you configure the rule from the API or Amazon Command Line Interface (Amazon CLI), check that your
value
object uses the correct type field (for example,doubleValue
for aDOUBLE
property).
Error: User: <role-arn> is not authorized to perform: iotsitewise:BatchPutAssetPropertyValue on resource
Your rule isn't authorized to access the target asset property, or the target asset property doesn't exist. Try the following:
-
Check that your property alias is correct and that you have an asset property with the given property alias. For more information, see Mapping industrial data streams to asset properties.
-
Check that your rule has a role and that the role allows
iotsitewise:BatchPutAssetPropertyValue
permission to the targeted asset property, such as through the target asset's hierarchy. For more information, see Granting Amazon IoT the required access.
Error: iot.amazonaws.com is unable to perform: sts:AssumeRole on resource: <role-arn>
Your IAM user isn't authorized to assume the role on your rule.
Check that your IAM user is allowed iam:PassRole
permission to the role
on your rule. For more information, see Pass role permissions in the
Amazon IoT Developer Guide.
Info: No requests were sent. PutAssetPropertyValueEntries was empty after performing substitution templates.
This message is an INFO
level log.
Your request must have at least one entry with all of the required parameters.
Check that your rule's parameters, including substitution templates, result in
non-empty values. Substitution templates can't access values defined in AS
clauses in your rule query statement. For more information, see Substitution templates in the Amazon IoT Developer Guide.