Webinar Recap: How to Easily Send and Use your IoT Data in the Cloud

Our webinar was broadcasted & recorded on May 25th 2016. During this broadcast Rapid7 Consulting Software Architect David Tracey discussed how to easily capture, aggregate, analyze and alert on your IoT data using Logentries.

Below is a brief summary of some of the topics David covered. To watch a recording of the full webinar on-demand, click here.

Sending TI SensorTag data to Logentries

IOT-made-real-using-TI-SensorTag-data-with-logentries (1)
Set up Node-Red

    1. Install nodejs
    2. Install Node-Red
> sudo npm install -g node-red
    1. In your node-red node_modules directory, e.g. /usr/local/lib/node_modules/node-red
> node red.js --userDir /home/myname/node-red-data/
  1. Connect to Node Red using the URL and you will see a screen appear that allows you to create a flow
  2. The Screenshot below shows a flow created simply by moving the “inject” and “debug” (appears a msg.payload) node icons from the left panel’s input and output sections to the main panel and connecting them. Clicking on the node allows you to update its configuration, e.g. renamed input to Test Generator and set the message it sends.NodeRedFlow
  3. Click “Deploy” in the upper right of the screen and the flow is deployed. Then each time the “button” on the left of the “Test Generator” is pressed a message appears in the Debug panel on the right.

Sending Data to Logentries from Node-Red

  1. Install Logentries Node-Red node (this includes Logentries node module which can also be downloaded separately from here and this includes examples for its use outside Node-Red)
    > sudo npm node-red-contrib-logentries

    Note this node module consists of two files for Node-Red (a .html file to show the icon for the Logentries node and a .js file to interface between Node-Red and the Logentries NodeJS library)

  2. Get a Logentries Account (you can set up a free trial account!)
  3. Login to your Logentries account and create a log in Logentries using the Token TCP type, where a token is generated which uniquely identifies the destination log – “How to Set up / Create A Token-based Log”.
  4. Go to that log in Logentries.com and and grab its “token”. That token is what goes into the configuration of the Node-Red node.
  5. Drag the Logentries node icon from the storage section of the left panel into the main Node-Red panel of the flow created earlier. The icon will have a red triangle on top indicating it needs to be configured.
  6. Click on the Logentries node icon and enter the token for that node in the configuration window
    (the red triangle goes away if this is correct)
  7. The Screenshot shows a flow created simply by adding a link between the Logentries node and the “Test Generator”. Now deploy this flow and each time the “button” on the left of the “Test Generator” is pressed a message is sent to your Logentries account and appears in the debug panel on the right.

Add SensorTag to Node-Red

  1. Go to https://github.com/node-red/node-red-nodes to see the range of nodes available for Node-Red. The SensorTag repository is under https://github.com/node-red/node-red-nodes/tree/master/hardware/sensorTag
  2. https://github.com/node-red/node-red-nodes/tree/master/hardware
    > sudo npm install node-red-node-sensortag

    Note: This node module uses a separate library to access the SensorTag over BTLE that currently only supports using 1 SensorTag at a time.

  3. Install the SensorTag library – see separate note below for steps that may be required before installing this module
    > sudo npm install sensortag

    Note: See https://www.npmjs.com/package/sensortag and https://github.com/sandeepmistry/node-sensortag

  4. Start the Node-Red server again (Note: needs to run as root to access the Linux Bluetooth 4.0 system calls)
    > sudo node red.js --userDir /home/myname/node-red-data/
  5. Drag the TagSensor node icon from the advanced section of the left panel into the main Node-Red panel of a flow with Logentries node (or just add it to the earlier flow and you see the output in the debug panel and can mix in messages from the test generator).
  6. The Screenshot shows the resulting flow above – you see “discovering” under the SensorTag icon, which changes to “connected” when you switch on your SensorTag device and it connects successfully over Bluetooth. You will also see the messages from the SensorTag appear in the debug panel in the right and these messages are also sent to your Logentries account.
  7. Go to Logentries.com and log into your account and select the log whos token you configured in Node-Red. Your can use LiveTail to see the messages as they arrive or can you do a search and you will see a screenshot like below where the data sent by SensorTag can be seen, with one example of a label “Too Hot” set when the temperature was above 23. The next blog will show how easily this data can be searched and analysed using LEQL once it is in Logentries.

Get started now

To watch the full webinar on-demand, click here.

If you haven’t already, create a free Logentries account to follow along during the webinar. Click here to get started.

Tagged with: , , ,
Posted in Cloud, How To, IoT, Log Management, Logentries, Webinar

Leave a Reply