Create a collector

Creates a new Better Stack collector.

The platform, data_region, and custom_bucket attributes can only be set during creation and cannot be updated later.

POST https://telemetry.betterstack.com/api/v1/collectors

Headers

Authorization
required string

Body parameters

name
required string
platform
required string
note
string
team_name
string
data_region
string
logs_retention
integer
metrics_retention
integer
ingesting_paused
boolean
source_vrl_transformation
string
custom_bucket
object
user_vector_config
string
configuration
object
proxy_config
object
databases
array

Configuration Object

The configuration object allows for fine-grained control over the collector's behavior.

Key Type Description
components object A flat object of boolean flags to enable or disable specific data collection components (e.g., ebpf_metrics: true, logs_docker: false).
logs_sample_rate integer The percentage (0-100) of logs to sample.
traces_sample_rate integer The percentage (0-100) of traces to sample.
vrl_transformation string A VRL program to transform telemetry data on the host before sending.
disk_batch_size_mb integer The maximum size (in MB) of on-disk batches. Minimum is 256.
memory_batch_size_mb integer The maximum size (in MB) of in-memory batches.
when_full string The buffer overflow strategy. Valid options are drop_newest (default) and block.
services_options object Per-service overrides for log sampling and trace ingestion.
namespaces_options object Per-namespace overrides for log sampling and trace ingestion (Kubernetes only).

Proxy Configuration Object

The proxy_config object is only applicable when platform is proxy.

Key Type Description
enable_buffering_proxy boolean Enables the collector to act as a buffering proxy.
buffering_proxy_listen_on string The address and port to listen on (e.g., 0.0.0.0:8080).
enable_ssl_certificate boolean Enables SSL/TLS termination using a Let's Encrypt certificate.
ssl_certificate_host string The hostname for the SSL certificate.
enable_http_basic_auth boolean Enables HTTP Basic Authentication for incoming requests.
http_basic_auth_username string The username for HTTP Basic Auth.
http_basic_auth_password string The password for HTTP Basic Auth. This value is write-only and will not be returned in any API response.
201

Response body

{
  "data": {
    "id": "2",
    "type": "collector",
    "attributes": {
      "name": "New API Collector",
      "platform": "kubernetes",
      "note": "Created via API for testing.",
      "status": "offline",
      "secret": "new-collector-secret-goes-here",
      "team_id": 123,
      "team_name": "My Team",
      "data_region": "a3",
      "logs_retention": 30,
      "metrics_retention": 90,
      "configuration": {
        "components": {
          "logs_kubernetes": true
        },
        "logs_sample_rate": 100,
        "traces_sample_rate": 100,
        "vrl_transformation": null,
        "disk_batch_size_mb": 256,
        "memory_batch_size_mb": 10,
        "when_full": "drop_newest"
      },
      "proxy_config": null,
      "user_vector_config": null,
      "ingesting_paused": false,
      "source_vrl_transformation": null,
      "pinged_at": null,
      "created_at": "2023-10-28T12:00:00.000Z",
      "updated_at": "2023-10-28T12:00:00.000Z",
      "custom_bucket": null
    }
  }
}
422

Response body

{
  "errors": [
    "name has already been taken"
  ],
  "invalid_attributes": [
    "name"
  ]
}

Example: Basic Collector

cURL
curl -X POST "https://telemetry.betterstack.com/api/v1/collectors" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "My Docker Collector",
       "platform": "docker",
       "note": "For staging environment services."
     }'


Example: Collector with Configuration

cURL
curl -X POST "https://telemetry.betterstack.com/api/v1/collectors" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Configured K8s Collector",
       "platform": "kubernetes",
       "configuration": {
         "components": {
           "ebpf_metrics": true,
           "logs_kubernetes": true,
           "metrics_databases": false
         },
         "vrl_transformation": ".message = downcase!(.message)",
         "when_full": "block"
       }
     }'


Example: Proxy Collector with HTTP Basic Auth

cURL
curl -X POST "https://telemetry.betterstack.com/api/v1/collectors" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Secure Proxy Collector",
       "platform": "proxy",
       "proxy_config": {
         "enable_buffering_proxy": true,
         "buffering_proxy_listen_on": "0.0.0.0:8080",
         "enable_http_basic_auth": true,
         "http_basic_auth_username": "proxy_user",
         "http_basic_auth_password": "a-very-secret-password"
       }
     }'