Kaa releases
Skip to end of metadata
Go to start of metadata


The MongoDB log appender is responsible for transferring logs from the Operations server to the MongoDB database. The logs are stored in the table named logs_$applicationToken, where $applicationToken matches the token of the current application.

Creating MongoDB log appender in Admin UI

The easiest way to create a MongoDB log appender for your application is by using Admin UI.

Creating MongoDB log appender with REST API

It is also possible to create a MongoDB log appender for your application by using REST API. The following example illustrates how to provision the MongoDB log appender for the Cell Monitor demo application available in Kaa Sandbox.


The MongoDB log appender configuration should match the following Avro schema.

 Click here to expand...

Fields of avro schema:

  • MongoDB nodes - list of MongoDB hosts.
  • Authentication credentials - credentials used to authenticate on MongoDB cluster
  • Other fields which configure of connection to MongoDB

    name of database
    Max number of connections on per host
    Max wait time for connection(ms)
    Connection timeout (ms)
    Socket timeout (ms)
    Turn on socket keep alive (boolean value)
    Include or not client profile data (boolean value)
    Include or not server profile data (boolean value)

The following configuration taken from the Cell Monitor demo matches the previous schema.

 Click here to expand...



The following REST API call example illustrates how to create a new MongoDB log appender.

 Example result

Using with MongoDB log appender

We'll use Data collection demo from Kaa Sendbox. Our example will send data to Kaa and then persist it to MongoDB. Also, we'll do selection queries on persisted data.

We have next log schema: 

 Click here to expand...



Display string

 Click here to expand...

"Schema": { "Name": ""LogData"", "Namespace": ""org.kaaproject.kaa.schema.sample.logging"", "Display name": "null", "Fields": Field (3 rows) }


The following JSON example matches the previous schema.

 Click here to expand...

"level" : "KAA_INFO",
"tag" : "TEST_TAG",
"message" : "My simple message"


Go to Data collection demos in Sandbox.


Next, in the Admin UI follow to Data collection demo application



There can be was same one. You can add new with your parameters

Enter name of the new appender 

Select MongoDB appender type.

Add new node in the Configuration section (localhost:27017)

Also you can add some Authentication credentials

And other important parameters of configuration. You can change them or use default.


Now click Add button on the top of the screen to create and deploy appender.

Verify that newly created appender has appeared in list.

Now run Data collection demo application. Verify that logs have been successfully sent to Kaa


Run the application using the following command in the console:

Let's verify that our logs have been persisted in MongoDB. Go to Sandbox VM and run next command to connect MongoDB:


You should observe similar output:




Copyright © 2014-2015, CyberVision, Inc.

  • No labels