Log MQTT to DynamoDB
Logs all or selected MQTT activity to a DynamoDB database.
By default logs everything - change the topic in the MQTT node to be more selective (e.g. "my\path\#" or "my\topic")
In AWS create a DynamoDB table with a Partition Key "timestamp" and a Sort Key "topic". Within IAM create a programmatic user and give it full access to DynamoDB service. You'll need the public & private keys to configure the node in this flow along with the name of the table you have created.
Requires node-red-contrib-aws and configuration of your MQTT server & DynamoDB table details
[{"id":"c52154f0.f78048","type":"amazon dynamodb","z":"d0c2c5a0.2bb308","aws":"","region":"","operation":"put","tablename":"","name":"Put Data","x":640,"y":1260,"wires":[[]]},{"id":"baf5518.0160cb","type":"mqtt in","z":"d0c2c5a0.2bb308","name":"","topic":"#","qos":"2","broker":"","x":150,"y":1240,"wires":[["e32f375.4a5adc8"]]},{"id":"e32f375.4a5adc8","type":"function","z":"d0c2c5a0.2bb308","name":"Add topic & timestamp to payload","func":"var out={\n timestamp: { \"S\": new Date().toISOString() },\n topic: { \"S\": msg.topic },\n data: { \"S\": msg.payload }\n} ;\n\nmsg.payload=out;\n\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":1240,"wires":[["c52154f0.f78048","935b131d.51635"]]},{"id":"935b131d.51635","type":"debug","z":"d0c2c5a0.2bb308","name":"","active":false,"console":"false","complete":"false","x":650,"y":1220,"wires":[]},{"id":"dcc200c9.3a9b5","type":"comment","z":"d0c2c5a0.2bb308","name":"Log everything","info":"","x":140,"y":1200,"wires":[]}]