KURAMOTOAHUJA TAIRA (倉本A 平) Greetings!
Your scenario looks interesting!
Method 1: Output the message content to IoT Hub logs (if possible) and create an alert rule based on that.
The IoT Hub logs are not designed for real-time monitoring and alerting. They are more suitable for long-term storage and analysis of device-to-cloud messages.
Method 2: Add the elements to be alerted on to the device twin, monitor updates to it, and trigger alerts accordingly.
You need to manage the device twin and monitor updates. Not be suitable if you have a large number of devices and need to monitor multiple keys within the JSON messages.
Method 3: Send on the messages from IoT Hub to Event Hub, execute Functions using EventHubTrigger, and internally trigger alerts based on conditional branching within the Function.
This is a recommended approach for real-time monitoring and alerting based on the content of JSON messages. You can use IoT Hub message routing to route the messages to an Event Hub, and then use Azure Functions with EventHubTrigger to process the messages and trigger alerts based on the content of the messages. This approach provides flexibility in terms of the types of alerts you can trigger and the actions you can take based on those alerts.
Here are some references you might want to take a look for more details.
- Azure IoT Hub trigger for Azure Functions
- IoT Hub message routing
- Azure Functions with EventHubTrigger
- Azure Functions with SendGrid output binding for sending email alerts
Also, please refer below asks and lets us know if you have any other queries.
IoTHub Alert based on message content
How to configure alerts on Azure IOT hub device Data
Hope this helps. Please let us know if you have any additional questions or need further assistance. We would be glad to help you.
If the response helped, please do click Accept Answer and Yes . Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.