Unknown macro: {style}


Unknown macro: { margin}
Unknown macro: {div}
Kaa releases
Unknown macro: {div}

Page tree
Skip to end of metadata
Go to start of metadata

The file system log appender stores received logs into the local file system of the Operations server. This log appender may be used for test purposes or in pair with tools like Flume and others. Logs are stored in files under the /$logsRootPath/tenant_$tenantId/application_$applicationId folder, where logsRootPath is a configuration parameter, tenantId and applicationId  are ids of the current tenant and the application respectively. Access to the logs is controlled via Linux file system permissions.

You can log in to the Operations server host and browse logs using the kaa_log_user_$applicationToken user name and the pubic key which is created as a part of the configuration.

Creating file system log appender in Admin UI

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

Creating file system log appender with REST API

It is also possible to create a file system log appender for your application by using REST API. The following example illustrates how to provision the file system log appender via REST API.


The file system log appender configuration should match the following Avro schema.

 Click here to expand...
            "displayName":"Public Key",
            "displayName":"Logs root path",
            "displayName":"Rolling file name pattern",
            "displayName":"Rolling max history",
            "displayName":"Trigger max file size",
            "displayName":"Encoder pattern",
            "default":"%-4relative [%thread] %-5level %logger{35} - %msg%n",
Name of public key
Root path for logs
Pattern for creating file name
Max number for records in file
Max size of file
Pattern for encoder


The following configuration example matches the previous schema.

 Click here to expand...
    "encoderPattern":"%-4relative [%thread] %-5level %logger{35} - %msg%n"



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

curl -v -S -u devuser:devuser123 -X POST -H 'Content-Type: application/json' -d'{"pluginClassName": "org.kaaproject.kaa.server.appenders.file.appender.FileSystemLogAppender", "applicationId": 119, "applicationToken": "91786338058670361194", "jsonConfiguration": "{\"publicKey\":\"XXXXXXXXXXXXXXXXXXXXXXXXXX\",\"logsRootPath\":\"/kaa_log_uploads\",\"rollingFileNamePatern\":\"logFile.%d{yyyy-MM-dd}.log\",\"rollingMaxHistory\":30,\"triggerMaxFileSize\":\"1GB\",\"encoderPattern\":\"%-4relative [%thread] %-5level %logger{35} - %msg%n\" }", "description": "New sample file system log appender", "headerStructure": [ "KEYHASH","TIMESTAMP" ], "name": "New file system appender", "maxLogSchemaVersion": 2147483647, "minLogSchemaVersion": 1, "tenantId": "70"}' "http://localhost:8080/kaaAdmin/rest/api/logAppender" | python -mjson.tool
 Example result
    "appenderClassName": "org.kaaproject.kaa.server.appenders.file.appender.FileSystemLogAppender",
    "applicationId": "70",
    "applicationToken": "946558468095768",
    "configuration": "{\"publicKey\":\"XXXXXXXXXXXXXXXXXXXXXXXXXX\",\"logsRootPath\":\"/kaa_log_uploads_new\",\"rollingFileNamePatern\":\"logFile.%d{yyyy-MM-dd}.log\",\"rollingMaxHistory\":30,\"triggerMaxFileSize\":\"1GB\",\"encoderPattern\":\"%-4relative [%thread] %-5level %logger{35} - %msg%n\"}",
    "createdTime": 1417006362287,
    "createdUsername": "devuser",
    "description": "New sample file system log appender",
    "headerStructure": [
    "id": "161",
    "name": "New file system appender",
    "maxLogSchemaVersion": 2147483647, 
    "minLogSchemaVersion": 1,    
    "status": "REGISTERED",
    "tenantId": "10",
    "typeName": "File"

Using with File system log appender

You can create your application where you will use file system log appender

For this you should create application in Admin UI  

After that add new appender to your application

Enter name of the new appender 

Select File appender type.

Add new parameters of configuration or replace old.

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

Verify that newly created appender has appeared in list.

After that you can go to Data collection demos in Sandbox.

Run the application using the following command in the console:

$ java -jar DataCollectionDemo.jar


This logs you can fined in  /kaa_log_uploads/tenant_'number of tenant'/application_'your_application_token'/application.log

In this example /kaa_log_uploads/tenant_70/application_46527342666485986401/application.log

Copyright © 2014-2015, CyberVision, Inc.

  • No labels