---
title: "Create log stream"
method: POST
path: "/create_log_stream"
tags: ["Log Streams"]
---

# Create log stream

`POST /create_log_stream`

## Request

- Base URL: `https://happy-animal-123.convex.cloud/api/v1`
- URL: `https://happy-animal-123.convex.cloud/api/v1/create_log_stream`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `Authorization`
  - API key in header `Authorization`
  - API key in header `Authorization`

Create a new log stream for the deployment. Errors if a log stream of the
given type already exists.

## Request body

- union
  - object
    - `siteLocation` 'US1' | 'US3' | 'US5' | 'EU' | 'US1_FED' | 'AP1', required: The Datadog deployment locations, used to construct URLs
    - `ddApiKey` string, required: Datadog API key for authentication.
    - `ddTags` string[], required: Optional comma-separated list of tags. These are sent to Datadog in each log event via the `ddtags` field.
    - `service` string, nullable: Service name used as a special tag in Datadog.
    - `topics` LogTopic[], nullable: The topics this log stream is subscribed to. Omit to subscribe to all topics, including ones added in the future.
    - `logStreamType` 'datadog', required
  - object
    - `url` string, required: URL to send logs to.
    - `format` 'json' | 'jsonl', required
    - `topics` LogTopic[], nullable: The topics this log stream is subscribed to. Omit to subscribe to all topics, including ones added in the future.
    - `logStreamType` 'webhook', required
  - object
    - `apiKey` string, required: Axiom API key for authentication.
    - `datasetName` string, required: Name of the dataset in Axiom. This is where the logs will be sent.
    - `attributes` AxiomAttribute[], required: Optional list of attributes. These are extra fields and values sent to Axiom in each log event.
      - `key` string, required
      - `value` string, required
    - `ingestUrl` string, nullable: Optional ingest endpoint for Axiom
    - `topics` LogTopic[], nullable: The topics this log stream is subscribed to. Omit to subscribe to all topics, including ones added in the future.
    - `logStreamType` 'axiom', required
  - object
    - `dsn` string, required: Sentry Data Source Name (DSN) to route exceptions to.
    - `tags` object, nullable: Tags to add to all events routed to Sentry.
    - `logStreamType` 'sentry', required
  - object
    - `apiKey` string, required: PostHog project token.
    - `host` string, nullable: PostHog host URL. Defaults to https://us.i.posthog.com.
    - `serviceName` string, nullable: OTLP service.name attribute. Defaults to the deployment name.
    - `topics` LogTopic[], nullable: The topics this log stream is subscribed to. Omit to subscribe to all topics, including ones added in the future.
    - `logStreamType` 'postHogLogs', required
  - object
    - `apiKey` string, required: PostHog project token.
    - `host` string, nullable: PostHog host URL. Defaults to https://us.i.posthog.com.
    - `logStreamType` 'postHogErrorTracking', required

## Response `200`

- union
  - object
    - `id` string, required
    - `hmacSecret` string, required: Use this secret to verify webhook signatures.
    - `logStreamType` 'webhook', required
  - object
    - `id` string, required
    - `logStreamType` 'datadog', required
  - object
    - `id` string, required
    - `logStreamType` 'axiom', required
  - object
    - `id` string, required
    - `logStreamType` 'sentry', required
  - object
    - `id` string, required
    - `logStreamType` 'postHogLogs', required
  - object
    - `id` string, required
    - `logStreamType` 'postHogErrorTracking', required

---

[API](https://skmtc.dev/operatornest/apis/convex-deployment-api.md) · [All operations](https://skmtc.dev/operatornest/apis/convex-deployment-api/llms.txt) · [OpenAPI document](https://skmtc.dev/operatornest/apis/convex-deployment-api/revisions/bd0de6c553a7?raw)
