5 Replies Latest reply on Apr 17, 2015 2:20 PM by vladimirros RSS
    praveenp Explorer

    Post System log events to Data Table

    Hi,


    We want to post our system log events in to the data table. How can i achieve this and is there any another possible way to post the log events.



      • Post System log events to Data Table
        polinao Collaborator

        In your Mashup, when you add services, select entity "Logs", then using the picker you can select any of the logs available. Then using the service you may drop all data onto a grid.

         

        • Post System log events to Data Table
          praveenp Explorer

          How can we add services to the Mashup, doesn't see that option could you help?

           

            • Post System log events to Data Table
              paic Collaborator

              Hi Praveen,

               


              First of all what is the use case for wanting to post that to a DataTable?

              As Polina pointed out, you have full access to the logs through associated services.


              If you want to log to a DataTable, you can just do it through a Service directly.


              If you have trouble with creating services or adding services to mashups, I recommend you attend a Thingworx Fundamentals training or go through the eLearning.



            • Post System log events to Data Table
              praveenp Explorer

               

              I gone through the tutorials and analyzed that those are ThingWorx logs But we are looking for below scenario. 


              Want to send our own system generated events/logs to the ThingWorx server and want to display those in the appropriate Mashup. Here events are basically my system logs and  want to send those logs to ThingWorx server using ThingWorx REST API.



              • Post System log events to Data Table
                vladimirros Creator

                Hi Praveen,

                In order to do this, you'll need to create a DataTable or a Stream in ThingWorx, with an associated DataShape that probably will consist of only 1 Field, the MessageLogText.
                Then you'll create a service that'll take 2 parameters, Timestamp and MessageLogText, and using these two, will make inserts in the ThingWorx DataTable or Stream.
                Key here is that this service you'll create will be automatically REST-ified, so you can call it from your DB.

                That's one way of doing it, but take care that if the TW server will be offline then the REST calls to it will obviously fail.
                Another method would be to store the messages in some DB, and then use some very simple SQL services only in order to display the data in your mashup, not necessarily storing it.
                A Mesage Queue broker is also another alternative, so as soon as you insert a message, you can trigger an Insert into your TW storage with your message content. In order to do this you would need to develop an simple extension that will act as a Listener for the queue.

                Hope it helps,
                Vladimir