Skip to content

Create a log drain for a project

post/v2/projects/{ref}/analytics/log-drains

OAuth scopes

  • analytics_config:write

This endpoint is only available on the following plans:

  • Pro
  • Team
  • Enterprise

The fine-grained token must include the following permissions to access this endpoint:

  • analytics_config_write

Path parameters

  • ref
    Required
    string

    Project ref

Body

  • data
    Required
    object

Response codes

  • 201
  • 401
  • 402
  • 403
  • 429
  • 500

Response (201)

{
"data": {
"type": "log_drain",
"id": "lorem",
"attributes": {
"name": "lorem",
"description": "lorem",
"config": {
"url": "lorem",
"http": "http1",
"gzip": true,
"headers": {
"property1": "lorem",
"property2": "lorem"
}
},
"backend_type": "postgres"
}
}
}
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Resource type.",
"enum": [
"log_drain"
]
},
"id": {
"type": "string"
},
"attributes": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"config": {
"anyOf": [
{
"type": "object",
"properties": {
"url": {
"type": "string"
},
"http": {
"type": "string",
"enum": [
"http1",
"http2"
]
},
"gzip": {
"type": "boolean"
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"title": "webhook"
},
{
"type": "object",
"properties": {
"api_key": {
"type": "string"
},
"region": {
"type": "string"
}
},
"title": "datadog"
},
{
"type": "object",
"properties": {
"url": {
"type": "string"
},
"username": {
"type": "string",
"nullable": true
},
"password": {
"type": "string",
"nullable": true
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"title": "loki"
},
{
"type": "object",
"properties": {
"dsn": {
"type": "string"
}
},
"title": "sentry"
},
{
"type": "object",
"properties": {
"domain": {
"type": "string"
},
"api_token": {
"type": "string"
},
"dataset_name": {
"type": "string"
}
},
"title": "axiom"
},
{
"type": "object",
"properties": {
"host": {
"type": "string"
},
"port": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"tls": {
"default": false,
"type": "boolean"
},
"structured_data": {
"type": "string"
},
"cipher_key": {
"type": "string"
},
"ca_cert": {
"type": "string"
},
"client_cert": {
"type": "string"
},
"client_key": {
"type": "string"
}
},
"title": "syslog"
},
{
"type": "object",
"properties": {
"s3_bucket": {
"type": "string"
},
"storage_region": {
"type": "string"
},
"access_key_id": {
"type": "string"
},
"secret_access_key": {
"type": "string"
},
"batch_timeout": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
},
"title": "s3"
},
{
"type": "object",
"properties": {
"region": {
"type": "string"
},
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"title": "last9"
},
{
"type": "object",
"properties": {
"endpoint": {
"type": "string"
},
"protocol": {
"default": "http/protobuf",
"type": "string"
},
"gzip": {
"default": true,
"type": "boolean"
},
"headers": {
"default": {},
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"title": "otlp"
}
]
},
"backend_type": {
"type": "string",
"enum": [
"postgres",
"bigquery",
"clickhouse",
"webhook",
"datadog",
"loki",
"sentry",
"s3",
"axiom",
"last9",
"otlp",
"syslog"
]
}
},
"required": [
"name",
"config",
"backend_type"
]
}
},
"required": [
"type",
"id",
"attributes"
]
}
},
"required": [
"data"
]
}