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 Cassandra log appender is responsible for transferring logs from the Operations server to the Cassandra database. The logs are stored in the table named logs_$applicationToken, where $applicationToken matches the token of the current application.

Creating Cassandra log appender in Admin UI

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

Creating Cassandra log appender with REST API

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

Configuration

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

{
  "namespace": "org.kaaproject.kaa.server.appenders.cassandra.config.gen",
  "type": "record",
  "name": "CassandraConfig",
  "fields": [
    {
      "name": "cassandraServers",
      "displayName": "Cassandra nodes",
      "minRowCount": 1,
      "type": {
        "type": "array",
        "items": {
          "namespace": "org.kaaproject.kaa.server.appenders.cassandra.config.gen",
          "type": "record",
          "name": "CassandraServer",
          "fields": [
            {
              "name": "host",
              "displayName": "Host",
              "weight": 0.75,
              "by_default": "localhost",
              "type": "string"
            },
            {
              "name": "port",
              "displayName": "Port",
              "weight": 0.25,
              "by_default": 9042,
              "type": "int"
            }
          ]
        }
      }
    },
    {
      "name": "keySpace",
      "displayName": "Keyspace name",
      "type": "string"
    },
    {
      "displayName": "Authentication credentials",
      "namespace": "org.kaaproject.kaa.server.appenders.cassandra.config.gen",
      "name": "cassandraCredential",
      "type": [
        {
          "type": "record",
          "name": "CassandraCredential",
          "optional": true,
          "fields": [
            {
              "name": "user",
              "displayName": "User",
              "weight": 0.5,
              "by_default": "user",
              "type": "string"
            },
            {
              "name": "password",
              "displayName": "Password",
              "weight": 0.5,
              "by_default": "password",
              "type": "string"
            }
          ]
        },
        "null"
      ]
    },
    {
      "namespace": "org.kaaproject.kaa.server.appenders.cassandra.config.gen",
      "by_default": "UNLOGGED",
      "optional": true,
      "name": "cassandraBatchType",
      "displayName": "Cassandra batch type",
      "type": [
        {
          "name": "CassandraBatchType",
          "type": "enum",
          "symbols": [
            "LOGGED",
            "UNLOGGED"
          ]
        },
        "null"
      ]
    },
    {
      "namespace": "org.kaaproject.kaa.server.appenders.cassandra.config.gen",
      "name": "cassandraSocketOption",
      "displayName": "Cassandra socket option",
      "optional": true,
      "type": [
        {
          "name": "CassandraSocketOption",
          "type": "record",
          "fields": [
            {
              "name": "sendBufferSize",
              "displayName": "Set send buffer size",
              "by_default": 8192,
              "optional": true,
              "type": [
                "int",
                "null"
              ]
            },
            {
              "name": "receiveBufferSize",
              "displayName": "Set receive buffer size",
              "by_default": 8192,
              "optional": true,
              "type": [
                "int",
                "null"
              ]
            },
            {
              "name": "soLinger",
              "displayName": "Delay before a reset is sent",
              "by_default": 0,
              "optional": true,
              "type": [
                "int",
                "null"
              ]
            },
            {
              "name": "connectionTimeout",
              "displayName": "Connection timeout (ms)",
              "by_default": 5000,
              "optional": true,
              "type": [
                "int",
                "null"
              ]
            },
            {
              "name": "readTimeout",
              "displayName": "Read timeout (ms)",
              "by_default": 12000,
              "optional": true,
              "type": [
                "int",
                "null"
              ]
            },
            {
              "name": "reuseAddress",
              "displayName": "Reuse address",
              "by_default": false,
              "optional": true,
              "type": [
                "boolean",
                "null"
              ]
            },
            {
              "name": "keepAlive",
              "displayName": "Use keep alive",
              "by_default": false,
              "optional": true,
              "type": [
                "boolean",
                "null"
              ]
            },
            {
              "name": "tcpNoDelay",
              "displayName": "Tcp no delay",
              "by_default": false,
              "optional": true,
              "type": [
                "boolean",
                "null"
              ]
            }
          ]
        },
        "null"
      ]
    },
    {
      "name": "callbackThreadPoolSize",
      "displayName": "Callback thread pool size",
      "by_default": 2,
      "type": [
        "int",
        "null"
      ]
    },
    {
      "namespace": "org.kaaproject.kaa.server.appenders.cassandra.config.gen",
      "name": "cassandraWriteConsistencyLevel",
      "displayName": "Write consistency level",
      "by_default": "ONE",
      "type": [
        {
          "name": "CassandraWriteConsistencyLevel",
          "type": "enum",
          "optional": true,
          "symbols": [
            "ANY",
            "ONE",
            "TWO",
            "THREE",
            "QUORUM",
            "ALL",
            "LOCAL_QUORUM",
            "EACH_QUORUM",
            "SERIAL",
            "LOCAL_SERIAL",
            "LOCAL_ONE"
          ]
        },
        "null"
      ]
    },
    {
      "namespace": "org.kaaproject.kaa.server.appenders.cassandra.config.gen",
      "name": "cassandraCompression",
      "by_default": "NONE",
      "optional": true,
      "displayName": "Compression type",
      "type": [
        {
          "name": "CassandraCompression",
          "type": "enum",
          "symbols": [
            "NONE",
            "SNAPPY",
            "LZ4"
          ]
        },
        "null"
      ]
    },
    {
      "namespace": "org.kaaproject.kaa.server.appenders.cassandra.config.gen",
      "name": "cassandraExecuteRequestType",
      "by_default": "SYNC",
      "optional": true,
      "displayName": "Cassandra execute request type",
      "type": [
        {
          "name": "CassandraExecuteRequestType",
          "type": "enum",
          "symbols": [
            "SYNC",
            "ASYNC"
          ]
        },
        "null"
      ]
    }
  ]
}

The following configuration example matches the previous schema.

{
    "cassandraServers":[
        {
            "host":"127.0.0.1",
            "port":9042
        }
    ],
    "cassandraCredential":{
        "org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraCredential":{
            "user":"your_user_name",
            "password":"your_password"
        }
    },
    "keySpace":"kaa_logs",
    "cassandraBatchType":{
        "org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraBatchType":"LOGGED"
    },
    "cassandraSocketOption":null,
    "callbackThreadPoolSize":{
        "int":5
    },
    "cassandraWriteConsistencyLevel":{
        "org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraWriteConsistencyLevel":"ONE"
    },
    "cassandraCompression":null,
    "cassandraExecuteRequestType":{
        "org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraExecuteRequestType":"SYNC"
    }
}

NOTE
Before using the Cassandra log appender, you need to create Cassandra KEYSPACE with the corresponding replication factor and strategy class.

Administration

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

curl -v -S -u devuser:devuser123 -X POST -H 'Content-Type: application/json' -d '{"pluginClassName":"org.kaaproject.kaa.server.appenders.cassandra.appender.CassandraLogAppender", "applicationId":"113", "applicationToken":"08690892651366457342", "jsonConfiguration":"{\"cassandraServers\":[{\"host\":\"127.0.0.1\",\"port\":9042}], \"cassandraCredential\":{\"org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraCredential\":{\"user\":\"us\",\"password\":\"psswd\"}}, \"keySpace\":\"kaa_logs\", \"cassandraBatchType\":{\"org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraBatchType\":\"LOGGED\"}, \"cassandraSocketOption\":null, \"callbackThreadPoolSize\":{\"int\":5}, \"cassandraWriteConsistencyLevel\":{\"org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraWriteConsistencyLevel\":\"ONE\"}, \"cassandraCompression\":null, \"cassandraExecuteRequestType\":{\"org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraExecuteRequestType\":\"SYNC\"}}", "description":"New sample Cassandra log appender", "headerStructure":["KEYHASH", "TIMESTAMP"], "name":"New Cassandra DB appender", "maxLogSchemaVersion":2147483647, "minLogSchemaVersion":1, "tenantId":"10"}' "http://localhost:8080/kaaAdmin/rest/api/logAppender" | python -mjson.tool
 Example result
{
    "applicationId": "113",
    "applicationToken": "99589384065844422599",
    "confirmDelivery": true,
    "createdTime": 1426071306494,
    "createdUsername": "devuser",
    "description": "New sample Cassandra log appender",
    "headerStructure": [
        "KEYHASH",
        "TIMESTAMP"
    ],
    "id": "322",
    "jsonConfiguration": "{\"cassandraServers\":[{\"host\":\"127.0.0.1\",\"port\":9042}],\"keySpace\":\"kaa_logs\",\"cassandraCredential\":{\"org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraCredential\":{\"user\":\"us\",\"password\":\"psswd\"}},\"cassandraBatchType\":{\"org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraBatchType\":\"LOGGED\"},\"cassandraSocketOption\":null,\"callbackThreadPoolSize\":{\"int\":5},\"cassandraWriteConsistencyLevel\":{\"org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraWriteConsistencyLevel\":\"ONE\"},\"cassandraCompression\":null,\"cassandraExecuteRequestType\":{\"org.kaaproject.kaa.server.appenders.cassandra.config.gen.CassandraExecuteRequestType\":\"SYNC\"}}",
    "maxLogSchemaVersion": 2147483647,
    "minLogSchemaVersion": 1,
    "name": "New Cassandra DB appender",
    "pluginClassName": "org.kaaproject.kaa.server.appenders.cassandra.appender.CassandraLogAppender",
    "pluginTypeName": null,
    "tenantId": "70"
}

Copyright © 2014-2015, CyberVision, Inc.

  • No labels