Interface | Description |
---|---|
AccessPointCommand | |
GenericLogCollector |
Root interface for a log collector.
|
LogCollector |
Interface for a log collector.
|
LogDeliveryListener |
Interface for a log collector.
|
LogFailoverCommand | |
LogProcessor |
Processes the Logging requests and responses.
|
LogStorage |
Interface of a log storage.
|
LogStorageStatus |
Interface for a log storage status.
|
LogUploadStrategy |
Interface for log upload strategy.
|
PersistentLogStorageConstants |
Class | Description |
---|---|
AbstractLogCollector |
Reference implementation of @see LogCollector
|
BucketInfo |
Describes a unique log bucket.
|
DefaultLogCollector |
Reference implementation of @see LogCollector
|
DefaultLogUploadStrategy |
Reference implementation for
LogUploadStrategy . |
LogBucket |
The helper class which is used to transfer logs from
LogStorage to LogCollector . |
LogRecord |
Wrapper class to encapsulate Avro-generated log record.
|
RecordInfo |
Describes unique log record delivery info.
|
Enum | Description |
---|---|
LogUploadStrategyDecision |
Describes all possible decisions for a log upload strategy (
LogUploadStrategy ). |
Provides log collection stuff.
The Kaa Logging subsystem is designed to collect records (logs) of pre-configured structure, periodically deliver them from endpoints to Operation servers, and persist in the server for further processing, or submit to immediate stream analytics.
The Kaa logs structure is determined by the schema that is configurable.
Assume, log record schema has the following form:
{
"type": "record",
"name": "LogData",
"namespace": "org.kaaproject.sample",
"fields": [
{
"name": "level",
"type": {
"type": "enum",
"name": "Level",
"symbols": [
"DEBUG",
"ERROR",
"FATAL",
"INFO",
"TRACE",
"WARN"
]
}
},
{
"name": "tag",
"type": "string"
},
{
"name": "message",
"type": "string"
}
]
}
// Get a Log Collector reference
LogCollector logCollector = Kaa.getKaaClient().getLogCollector();
// Create a log entity (according to the org.kaaproject.sample.LogData sample schema above)
LogData logRecord = new LogData(Level.INFO, "tag", "message");
// Push record to collector
logCollector.addLogRecord(logRecord);
Kaa SDK logging stuff is based on three main components - log storage
(LogStorage
,
LogStorageStatus
), upload strategy
(LogUploadStrategy
) and configuration.
For each
of these components there is a reference implementation using by defaults
DefaultLogUploadStrategy
,
correspondingly).
The log storage is responsible for a log persistence.The reference implementation stores all added logs in a dynamic memory, so if there are some logs but application has been closed immediately or crashes, logs will be lost.
The log upload strategy is used to decide what Kaa should do after each
log record is added (LogUploadStrategyDecision
).
The configuration is used to define all limitations that affects on a log collection stuff. The reference implementation works with three parameters: batch volume (8KB), threshold volume (32KB) and maximum allowed volume (1MB).
If there are need in some specific triggers for upload or you want to use
more reliable storage, simply set your own implementation for interested
component (GenericLogCollector.setStorage(LogStorage)
,
GenericLogCollector.setStrategy(LogUploadStrategy)
.
Copyright © 2016. All rights reserved.