Unknown macro: {style}

.ia-secondary-container

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

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

The Oracle NoSQL log appender is responsible for transferring logs from the Operations server to the Oracle NoSQL key/value storage. Logs are stored in the storage using the following key path:

${applicationToken}/${logSchemaVersion}/${endpointKeyHash}/${uploadTimestamp}/${counter}

The path variables used are:

Path VariableDescription
applicationTokenThe token of the application
logSchemaVersionThe version of the log schema
endpointKeyHashThe ID of the endpoint the log data belongs to
uploadTimestampThe timestamp of log upload to the storage (in milliseconds)
countThe log record ID

Values are stored as serialized generic records using record wrapper Avro schema.

Creating Oracle NoSQL log appender with Admin UI

The easiest way to create an instance of the Oracle NoSQL log appender for the application is by using Admin UI.

Creating Oracle NoSQL log appender with REST API

It is also possible to create an instance of the Oracle NoSQL log appender for the application by using the REST API. The following example illustrates how to provision the Oracle NoSQL log appender via the REST API.

Configuration

The Oracle NoSQL log appender configuration should match the following Avro schema:

 Click here to expand...
{
   "namespace":"org.kaaproject.kaa.server.appenders.oraclenosql.config.gen",
   "type":"record",
   "name":"OracleNoSqlConfig",
   "fields":[
      {
         "name":"storeName",
         "displayName":"KVStore name",
         "default":"kvstore",
         "type":"string"
      },
      {
         "name":"kvStoreNodes",
         "displayName":"KVStore nodes",
         "minRowCount":1,
         "type":{
            "type":"array",
            "items":{
               "namespace":"org.kaaproject.kaa.server.appenders.oraclenosql.config.gen",
               "type":"record",
               "name":"KvStoreNode",
               "fields":[
                  {
                     "name":"host",
                     "displayName":"Host",
                     "weight":0.75,
                     "default":"localhost",
                     "type":"string"
                  },
                  {
                     "name":"port",
                     "displayName":"Port",
                     "weight":0.25,
                     "default":5000,
                     "type":"int"
                  }
               ]
            }
         }
      },
      {
         "name":"username",
         "displayName":"Username",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"walletDir",
         "displayName":"Oracle Wallet directory",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"pwdFile",
         "displayName":"Password store file",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"securityFile",
         "displayName":"Security properties file",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"transport",
         "displayName":"KVStore communication transport",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"ssl",
         "displayName":"Security transport",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"sslCipherSuites",
         "displayName":"SSL/TLS cipher suites",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"sslProtocols",
         "displayName":"SSL/TLS procotols",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"sslHostnameVerifier",
         "displayName":"SSL/TLS hostname verifier",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"sslTrustStore",
         "displayName":"Java truststore file location",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      },
      {
         "name":"sslTrustStoreType",
         "displayName":"Java truststore type",
         "optional":true,
         "type":[
            "string",
            "null"
         ]
      }
   ]
}

The following configuration example matches the previous schema.

{
   "storeName":"kvstore",
   "kvStoreNodes":[
      {
         "host":"localhost",
         "port":5000
      }
   ],
   "username":null,
   "walletDir":null,
   "pwdFile":null,
   "securityFile":null,
   "transport":null,
   "ssl":null,
   "sslCipherSuites":null,
   "sslProtocols":null,
   "sslHostnameVerifier":null,
   "sslTrustStore":null,
   "sslTrustStoreType":null
}

Administration

The following REST API call example illustrates how to create a new instance of the Oracle NoSQL log appender:

curl -v -S -u devuser:devuser123 -X POST -H 'Content-Type: application/json' -d'{"pluginClassName": "org.kaaproject.kaa.server.appenders.oraclenosql.appender.OracleNoSqlLogAppender", "applicationId": 119, "applicationToken": "91786338058670361194", "jsonConfiguration": "{\"storeName\":\"kvstore\",\"kvStoreNodes\":[{\"host\":\"localhost\",\"port\":5000}],\"username\":null,\"walletDir\":null,\"pwdFile\":null,\"securityFile\":null,\"transport\":null,\"ssl\":null,\"sslCipherSuites\":null,\"sslProtocols\":null,\"sslHostnameVerifier\":null,\"sslTrustStore\":null,\"sslTrustStoreType\":null}", "description": "Sample Oracle NoSQL appender", "headerStructure": [], "name": "Oracle NoSQL 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.oraclenosql.appender.OracleNoSqlLogAppender",
    "applicationId": "70",
    "applicationToken": "946558468095768",
    "configuration": "{\"storeName\":\"kvstore\",\"kvStoreNodes\":[{\"host\":\"localhost\",\"port\":5000}],\"username\":null,\"walletDir\":null,\"pwdFile\":null,\"securityFile\":null,\"transport\":null,\"ssl\":null,\"sslCipherSuites\":null,\"sslProtocols\":null,\"sslHostnameVerifier\":null,\"sslTrustStore\":null,\"sslTrustStoreType\":null}",
    "createdTime": 1417107992158,
    "createdUsername": "devuser",
    "description": "Sample Oracle NoSQL appender",
    "headerStructure": [],
    "id": "167",
    "name": "Oracle NoSQL appender",
    "maxLogSchemaVersion": 2147483647, 
    "minLogSchemaVersion": 1,
    "status": "REGISTERED",
    "tenantId": "10",
    "typeName": "Oracle NoSQL"
}

 Example

1.Download archive with Oracle nosql database and install it to your kaa server: 

http://www.oracle.com/technetwork/database/database-technologies/nosqldb/downloads/index.html

2.Use following tutorial for more information about this database: https://blogs.oracle.com/charlesLamb/entry/oracle_nosql_database_in_5

3.Create an application using Admin UI or Admin Rest API.

4. Add custom log schema that will be using for saving log in database.

5. Add Oracle Nosql log appender and define configuration for it.

6.Generate SDK appropriate to your platform and write code to send logs to database.

your client code might look like this:

...
KaaClient client = ...
...
Data data = new Data("your log data");
//send logs to oracle database
client.addLogRecord(data);
...

To see logs:

 open admin console:

java -jar path_to_oracle_db/lib/kvstore.jar runadmin -port $your_port$ -host $your_host$

 connect to your store:

connect store -name kvstore  -host $oracle_db_host$  -port $oracle_db_port$;

to see logs from kaa:

get kv -start /${applicationToken} -all

Than in your database you will see something like that:

/97657068517919541825/2/519xnHqR4xVpq2MSoLSUKgmSTa4=/1456227512249/-/0
{
  "recordHeader" : {
    "org.kaaproject.kaa.server.common.log.shared.avro.gen.RecordHeader" : {
      "endpointKeyHash" : null,
      "applicationToken" : null,
      "headerVersion" : null,
      "timestamp" : null,
      "logSchemaVersion" : null
    }
  },
  "recordData" : {
    "org.kaaproject.kaa.example.nosql.Data" : {
      "logInfo" : {
        "string" : "your log data"
      }
    }
  }
}

 

 

 

 

 

 


Copyright © 2014-2015, CyberVision, Inc.

  • No labels