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

To implement a custom log appender, you need to complete the following steps.

  1. Design and compile a configuration schema.
  2. Implement the log appender based on AbstractLogAppender.
  3. Develop the log appender descriptor.
  4. Provision the log appender.

We recommend that you use one of the existing log appender implementations as a reference.

Configuration schema

A log appender configuration schema is an Avro compatible schema that defines configuration parameters of the log appender. The following parameters in the schema affect Kaa Admin UI layout.

  • minRowCount - specifies a minimum number of rows in a UI table (only for arrays in the schema)
  • displayName - displays the name of the field on UI
  • displayNames - displays the name of each enumeration symbol on UI (only for enumeration fields in the schema)
  • default - displays the default value of the field on UI
  • optional - defines whether the field on UI is optional or mandatory
  • weight - defines a relative width of the corresponding column on UI (only for arrays in the schema)

 

Once you have prepared your schema, you can compile it using the following command.
java -jar /path/to/avro-tools-1.7.7.jar compile schema <schema file> <destination>
Please refer to Compiling the schema for more information. It is also possible to integrate the schema compilation with avro-maven-plugin.

Log appender implementation

All Kaa log appenders extend generic abstract class org.kaaproject.kaa.server.common.log.shared.appender.AbstractLogAppender<T>. The following code example illustrates the implementation of a custom log appender.


Log appender descriptor

A log appender descriptior provides Kaa with the information on how to locate and configure your custom log appender. To implement a log appender descriptor, you need to implement the AppenderConfig interface at first.

It is also important to provide your class with the @KaaPluginConfig annotation. This annotation helps Kaa Admin UI to find all available log appenders in the class path.

NOTE
A log appender descriptor is optional if you are going to configure your log appenders using only REST API.

The following code example illustrates the implementation of a log appender descriptor. 

Log appender provisioning

To provision your log appender, do the following:

  1. Build your log appender using next command:

  2. Place the log appender *.jar from /target folder into the /usr/lib/kaa-node/lib folder
  3. If you using different package than org.kaaproject.kaa.* you need to edit kaa-node.properties file in /usr/lib/kaa-node/conf folder. Specify additional package to scan kaa plugins configuration in parameter additional_plugins_scan_package.
  4. Restart kaa-node service:

  5. Use Admin UI or REST API to create/update/delete your log appender instances.

Copyright © 2014-2015, CyberVision, Inc.

  • No labels