Cluster logger

Create and manage cluster loggers.

See also logging for more information on common providers and templates.

Part of the API reference collection

This page is part of the Crunchy Bridge API reference, and primarily meant to act as an exhaustive guide for technical integrations which are already in progress. To understand the basics of using the API, see API concepts and getting started.

The ClusterLogger API resource

Response of a singleton cluster logger request.

Content type: application/json

Name Nullable Type Description
id string in EID format

Unique ID of the logger.

cluster_id string in EID format

The ID of cluster that the logger belongs to.

description string

Human-readable description of the logger. For purposes of convenience and bookkeeping only.

host string

Target host of the logger. See documentation for logging to get standard hostname configuration for common logging providers.

port integer

Target port of the logger. See documentation for logging to get standard port configuration for common logging providers.

team_id string in EID format

The ID of the team that owns the associated cluster.

template string

Template to use for the logger. See documentation for logging to get templates for common logging providers.

Example

{
    "cluster_id": "rvf73a77ozfsvcttryebfrnlem",
    "description": "LogDNA log destination.",
    "host": "syslog-a.logdna.com",
    "id": "s3q3zqzdr5fqbgya7xupxxpyva",
    "port": 6514,
    "team_id": "eaevtjiudzeq7bsqbbpiscund4",
    "template": "\u003c${PRI}\u003e1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [[email protected] key=\\\"MY-INGESTION-KEY\\\"] $MSG\\n"
}

List loggers

List existing loggers for a cluster.

GET /clusters/{cluster_id}/loggers

Request

Path parameters

  • cluster_id: Unique ID of the cluster.

Query parameters

Name Required Type Description
cursor string

Return only items starting after this cursor ID. When paginating, pass the value of next_cursor from the last page into this field to get the next one.

limit integer

The maximum number of items to return on the page. Defaults to 100 with a minimum of 1 and a maximum of 100.

order enum string

The order of pagination. asc for ascending or desc for descending. Defaults to asc.

Enum asc, or desc.

order_field string

The name of the field on which to paginate like id or name. Supported fields are specific to each endpoint, and it’s not possible to specify any arbitrary name. See the documentation for each specific list endpoint to see which fields it supports. Defaults to id for most resources.

cURL example

curl -X GET https://api.crunchybridge.com/clusters/{cluster_id}/loggers
    -H "Authorization: Bearer $CRUNCHY_API_KEY"

Response

Status: 200

Response of a list cluster logger request.

Content type: application/json

Name Nullable Type Description
loggers array of object of type ClusterLogger

Loggers configured for a cluster.

Example

{
    "loggers": [
        {
            "cluster_id": "rvf73a77ozfsvcttryebfrnlem",
            "description": "LogDNA log destination.",
            "host": "syslog-a.logdna.com",
            "id": "s3q3zqzdr5fqbgya7xupxxpyva",
            "port": 6514,
            "team_id": "eaevtjiudzeq7bsqbbpiscund4",
            "template": "\u003c${PRI}\u003e1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [[email protected] key=\\\"MY-INGESTION-KEY\\\"] $MSG\\n"
        }
    ]
}

Create logger

Create a new logger for a cluster.

POST /clusters/{cluster_id}/loggers

Request

Path parameters

  • cluster_id: Unique ID of the cluster.

Request body schema

Content type: application/json

Name Required Type Description
host string

Target host of the logger.

port integer

Target port of the logger.

template string

Template to use for the logger.

description string

Description of the logger.

Example request body

{
    "description": "LogDNA log destination.",
    "host": "syslog-a.logdna.com",
    "port": 6514,
    "template": "\u003c${PRI}\u003e1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [[email protected] key=\\\"MY-INGESTION-KEY\\\"] $MSG\\n"
}

cURL example

curl -X POST https://api.crunchybridge.com/clusters/{cluster_id}/loggers
    -H "Authorization: Bearer $CRUNCHY_API_KEY"
    -H "Content-Type: application/json"
    -d '{"description":"LogDNA log destination.","host":"syslog-a.logdna.com","port":6514,"template":"\u003c${PRI}\u003e1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [[email protected] key=\\\"MY-INGESTION-KEY\\\"] $MSG\\n"}'

Response

Status: 201

Responds with the standard ClusterLogger API resource.

Create query

Create (start executing) a query on a cluster.

The functionality of this endpoint is currently limited to performing in-band queries which are constrained by a 25 second statement timeout, and an API request’s normal timeout of 30 second beyond that. Future functionality will include asynchronous queries and caching.

Queries default to readonly to avoid accidental mutation. Set allow_write to true to make queries read/write.

POST /clusters/{cluster_id}/queries

Request

Path parameters

  • cluster_id: Unique ID of the cluster to query.

Request body schema

Content type: application/json

Name Required Type Description
sql string

SQL being executed as part of the query.

allow_write boolean

Set to true to allow a query to be read/write. Queries default to readonly to avoid accidental mutation.

database_name string

Name of the database to query.

Example request body

{
    "allow_write": false,
    "database_name": null,
    "sql": "SELECT 1;"
}

cURL example

curl -X POST https://api.crunchybridge.com/clusters/{cluster_id}/queries
    -H "Authorization: Bearer $CRUNCHY_API_KEY"
    -H "Content-Type: application/json"
    -d '{"allow_write":false,"database_name":null,"sql":"SELECT 1;"}'

Response

Status: 201

A cluster query and its result.

Content type: application/json

Name Nullable Type Description
id string in EID format

Unique ID of the query.

cluster_id string in EID format

The ID of cluster that the query is being executed on.

result array of array

The result of the query as a two-dimensional array of the returned rows and each field value within each.

result_fields array of object of type ClusterQueryResultField

Metadata on each field returned in the results.

Example

{
    "cluster_id": "rvf73a77ozfsvcttryebfrnlem",
    "id": "agbk2tous2pmi2ehnjbvkxo7gi",
    "result": [
        [
            1
        ],
        [
            2
        ],
        [
            3
        ]
    ],
    "result_fields": null
}

The ClusterQueryResultField object

Metadata on a query result field

Name Nullable Type Description
name string

The name of the field.

Get logger

Get an existing logger for a cluster.

GET /clusters/{cluster_id}/loggers/{logger_id}

Request

Path parameters

  • cluster_id: Unique ID of the cluster.
  • logger_id: Unique ID of the logger.

cURL example

curl -X GET https://api.crunchybridge.com/clusters/{cluster_id}/loggers/{logger_id}
    -H "Authorization: Bearer $CRUNCHY_API_KEY"

Response

Status: 200

Responds with the standard ClusterLogger API resource.

Update logger

Update an existing logger for a cluster.

PUT /clusters/{cluster_id}/loggers/{logger_id}

Request

Path parameters

  • cluster_id: Unique ID of the cluster.
  • logger_id: Unique ID of the logger.

Request body schema

Content type: application/json

Name Required Type Description
host string

Target host of the logger.

port integer

Target port of the logger.

template string

Template to use for the logger.

description string

Description of the logger.

Example request body

{
    "description": "LogDNA log destination.",
    "host": "syslog-a.logdna.com",
    "port": 6514,
    "template": "\u003c${PRI}\u003e1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [[email protected] key=\\\"MY-INGESTION-KEY\\\"] $MSG\\n"
}

cURL example

curl -X PUT https://api.crunchybridge.com/clusters/{cluster_id}/loggers/{logger_id}
    -H "Authorization: Bearer $CRUNCHY_API_KEY"
    -H "Content-Type: application/json"
    -d '{"description":"LogDNA log destination.","host":"syslog-a.logdna.com","port":6514,"template":"\u003c${PRI}\u003e1 ${ISODATE} ${HOST} ${PROGRAM} ${PID} ${MSGID} [[email protected] key=\\\"MY-INGESTION-KEY\\\"] $MSG\\n"}'

Response

Status: 200

Responds with the standard ClusterLogger API resource.

Destroy logger

Delete an existing logger for a cluster.

DELETE /clusters/{cluster_id}/loggers/{logger_id}

Request

Path parameters

  • cluster_id: Unique ID of the cluster.
  • logger_id: Unique ID of the logger.

cURL example

curl -X DELETE https://api.crunchybridge.com/clusters/{cluster_id}/loggers/{logger_id}
    -H "Authorization: Bearer $CRUNCHY_API_KEY"

Response

Status: 200

Responds with the standard ClusterLogger API resource.