# ZevSight documentation: full text > Every page of https://docs.zevsight.com in one file, in reading order. Each page starts with a `===` line, its title, summary and source URL. The index is https://docs.zevsight.com/llms.txt and the OpenAPI file is https://docs.zevsight.com/openapi.yaml. === # Introduction > What ZevSight is, what it watches, and where to start in these docs. Source: https://docs.zevsight.com/introduction ZevSight is ZevOp's observability product. It brings together the things you use to keep a service running: - **Logs.** Send structured logs over HTTP, OpenTelemetry or the Node.js SDK. Search them, follow them in live tail, group them into patterns and save views. - **Uptime checks.** Check HTTP, TCP, DNS and TLS endpoints from several probe regions. A check counts as down only when enough regions agree. - **Heartbeats.** Cron jobs and workers ping a URL. ZevSight raises an alert when a ping is late or reports a failure. - **Alerts and incidents.** Rules on logs, checks and heartbeats escalate to people, teams and channels: email, Slack, signed webhooks and ZevThread. Each alert opens an incident with a timeline, a lead, notes, a runbook link and a post-mortem. - **Status pages.** Public pages on `zevstatus.com` or your own domain. They have components, incident reports, maintenance windows, subscribers, badges and a JSON feed. Everything belongs to a **workspace**. Inside it, a **project** holds **services**, and each service runs in **environments** such as `production` and `staging`. Data stays in the project's data region. See [Core concepts](/concepts). ## Where to start | You want to | Read | |---|---| | Send a first log in two minutes | [Quickstart](/quickstart) | | Ship logs from an app | [HTTP ingest API](/send/http-api), [OpenTelemetry](/send/opentelemetry), [Node.js SDK](/send/nodejs) | | Find something in your logs | [Search syntax](/explore/search-syntax) | | Know when a site or job breaks | [Uptime checks](/monitor/uptime-checks), [Heartbeats](/monitor/heartbeats) | | Page the right people | [Alerts and rules](/respond/alerts), [Escalation](/respond/escalation) | | Tell customers what is happening | [Status pages](/status-pages) | | Let an AI agent help | [Use ZevSight with AI agents](/ai-agents) | ## Hosts | Host | Used for | |---|---| | `https://app.zevsight.com` | The dashboard | | `https://ingest.zevsight.com` | Sending events and heartbeat pings (EU data region) | | `https://eu.zevsight.com` | Search, live tail, check data and alert actions (EU data region) | | `https://api.zevsight.com` | Notes on incidents and alerts | | `https://.zevstatus.com` | Your published status pages | ## For AI agents Every page has a Markdown version: add `.md` to its URL. [`/llms.txt`](/llms.txt) lists every page with a one-line summary, [`/llms-full.txt`](/llms-full.txt) holds every page in one file, and [`/openapi.yaml`](/openapi.yaml) describes the HTTP API. === # Quickstart > Send your first log to ZevSight in about two minutes and watch it arrive in live tail. Source: https://docs.zevsight.com/quickstart You will create a project and a service, copy an ingest token, send one log line and see it in live tail. ## 1. Create a project 1. Sign in at [app.zevsight.com](https://app.zevsight.com) with your ZevID. If this is your first time, create a workspace. 2. Onboarding asks for a **project name**, a **data region** and a **retention** period. The region cannot be changed later. Retention defaults to the longest your plan allows. ## 2. Create an ingest token Pick a **service** (for example `api`) and an **environment** (for example `production`). ZevSight creates an ingest token that can write to that one service environment. The token starts with `zsi_` and is shown **once**. Store it as `ZEVSIGHT_INGEST_KEY`: ```bash ZEVSIGHT_INGEST_KEY= ZEVSIGHT_ENDPOINT=https://ingest.zevsight.com ZEVSIGHT_ENVIRONMENT=production ``` > **Warning** > > An ingest token can only write. Keep it out of source control and out of browser code, like any other secret. If it leaks, rotate it from the service's **Connect** panel. ## 3. Send a log line With curl: ```bash curl -X POST https://ingest.zevsight.com/v1/ingest/events \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"events":[{"service":"api","environment":"production","severity":"info","type":"log","body":{"message":"Hello from ZevSight"}}]}' ``` A `202` response means the line was accepted: ```json { "accepted": 1, "rejected": [] } ``` Or from Node.js 18 or newer, with no dependencies: ```js const res = await fetch('https://ingest.zevsight.com/v1/ingest/events', { method: 'POST', headers: { Authorization: 'Bearer ' + process.env.ZEVSIGHT_INGEST_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ events: [{ service: 'api', environment: 'production', severity: 'info', type: 'log', attrs: { route: '/v1/pay' }, body: { message: 'Hello from ZevSight' }, }], }), }); console.log(res.status); // 202 = accepted ``` For real apps, use the [Node.js SDK](/send/nodejs) or [OpenTelemetry](/send/opentelemetry). Both batch, compress and retry for you. ## 4. See it in live tail Onboarding waits on the last step and shows **First line received** as soon as your line arrives. Choose **Open logs** to go to the explorer, where live tail is on by default. Send a few more lines and watch them stream in. Try a search in the query bar: ```text service:api level:>=warn ``` ## Next steps - [Core concepts](/concepts): how workspaces, projects, services and environments fit together. - [Search syntax](/explore/search-syntax): every filter the query bar accepts. - [Uptime checks](/monitor/uptime-checks) and [Heartbeats](/monitor/heartbeats): watch endpoints and cron jobs. - [Alerts and rules](/respond/alerts): get told when something breaks. === # Core concepts > How workspaces, projects, services, environments and data regions fit together in ZevSight. Source: https://docs.zevsight.com/concepts ```text workspace billing, members, teams, API keys, status pages └── project data region and retention ├── environments production, staging, development, … └── services api, worker, checkout, … └── service environment "api · production": what you monitor ``` ## Workspace The workspace is your organization in ZevSight. It holds members and their roles, teams, the plan and billing, alert channels and escalation policies, API keys, and status pages. You can belong to several workspaces and switch between them in the top bar. The API and some error messages call it an *organization*. ## Project A project is a product or system, such as `shop` or `internal-tools`. It sets two things that apply to all of its data: - **Data region.** Where its telemetry is stored. You choose it when you create the project and cannot change it later. - **Retention.** How long its events are kept. It can be up to the longest your plan allows. A new project starts with three environments: `production`, `staging` and `development`. On the wire a project has a public id such as `prj_8KdT3mQ2wXr7nB4cVhY9p`. ## Service and environment A **service** is one deployable thing: `api`, `worker`, `checkout`. An **environment** is where it runs. You monitor a service in an environment, the **service environment**, shown as `api · production`. Logs, checks, heartbeats, alert rules and ingest tokens are all scoped to service environments. Nothing is scoped to just a project. - Service names are slugs: lowercase letters, digits, `.`, `_` and `-`, up to 64 characters, starting with a letter or digit. A service can also have a display name. - Environment names use the same characters, up to 64. - A service environment is **active** once it has sent data or has a check, heartbeat or ingest token. Until then the dashboard offers **Set up**. - Services and environments are created automatically from the events you send, up to your plan's limits. Past a limit, events are stored under `unknown` and the original name is kept in `zs.original_service` or `zs.original_environment`. Nothing is dropped. ### How an event gets its service and environment 1. The event's own `service` and `environment` fields. Over OTLP these come from the `service.name` and `deployment.environment.name` (or `deployment.environment`) resource attributes. 2. If a field is missing and the ingest token is limited to one service or environment, that value is filled in. 3. Otherwise the service is `unknown` and the environment is `production`. Names are turned into slugs: `Checkout Service` becomes `checkout-service`. A token limited to some service environments refuses events for others. ## Data region Each data region has its own ingest and query hosts. Today the only region is the EU, hosted in Germany (Falkenstein): | Purpose | Host | |---|---| | Ingest and heartbeat pings | `https://ingest.zevsight.com` | | Search, live tail, check data, alerts | `https://eu.zevsight.com` | Telemetry never leaves its region. A credential used against another region's host gets `421 WRONG_REGION`, and the response's `endpoint` field names the right host. See [Data and retention](/workspace/data-and-retention). ## Event Every log line, heartbeat ping and check result is an event with the same envelope: `id` (UUIDv7), `ts`, `received_at`, `project`, `service`, `environment`, `type`, `severity`, `trace_id`, `span_id`, `attrs`, `resource` and `body`. See [HTTP ingest API](/send/http-api). ## Credentials | Credential | Prefix | Can | |---|---|---| | Ingest token | `zsi_` | Write events to one project, optionally limited to service environments | | API key | `zsr_` | Read (search, tail, check data, alerts), or also respond (acknowledge, resolve, snooze, add notes) | | Heartbeat ping URL | `hb_` token in the URL | Record pings for one heartbeat monitor | See [API keys and ingest tokens](/workspace/api-keys). === # HTTP ingest API > Send log events to ZevSight with one POST, as JSON or NDJSON, optionally gzip-compressed, with an ingest token. Source: https://docs.zevsight.com/send/http-api `POST https://ingest.zevsight.com/v1/ingest/events` Use this when there is no SDK for your language, or when you want full control. Full field reference: [Ingest API reference](/api/reference/ingest). ## Authenticate Send an ingest token (`zsi_…`) as a bearer token. It is the only header form accepted. ```http Authorization: Bearer ``` Find or create tokens in the dashboard: **Services → your service → Connect**. ## Send a batch ```bash curl -X POST https://ingest.zevsight.com/v1/ingest/events \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -H "Idempotency-Key: batch-2026-11-29-0001" \ -d '{ "events": [ { "service": "checkout", "environment": "production", "type": "log", "severity": "error", "ts": "2026-11-29T09:41:07.512Z", "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736", "attrs": { "route": "/v1/pay", "user.id": "42" }, "resource": { "host.name": "web-1" }, "body": { "message": "payment provider timeout after 3 retries", "fields": { "provider": "card", "attempt": 3 } } } ] }' ``` ### Formats | Content-Type | Body | |---|---| | `application/json` | `{"events": [ … ]}` with 1 to 5,000 events | | `application/x-ndjson` | One event object per line | Add `Content-Encoding: gzip` to send a compressed body. The size limit applies after decompression. ## Event fields | Field | Required | Notes | |---|---|---| | `type` | yes | `log` for log lines. `heartbeat` is also accepted; `check_result` is refused for ingest tokens. | | `body` | yes | For logs: `{"message": "...", "fields": { ... }}`. `message` is truncated above 64 KiB. `fields` holds structured data of any shape. | | `service` | | Slug, default `unknown` (or the token's service). | | `environment` | | Slug, default `production` (or the token's environment). | | `severity` | | A level name: `trace`, `debug`, `info`, `warn`, `error`, `fatal`. Common logger spellings also work: `warning`, `err`, `critical`, `panic`, `notice`, `verbose` and more. Send a string, not a number. | | `ts` | | RFC 3339. If it is more than 10 minutes in the future or more than 7 days in the past, the receive time is used and the original is kept in `attrs` as `zs.original_ts`. | | `id` | | UUIDv7. Omit it and one is generated. Send your own to make retries safe. | | `trace_id`, `span_id` | | 32 and 16 lowercase hex characters. Invalid values are moved aside, not rejected. | | `attrs` | | Flat string map, searchable as `attrs.:value`. Up to 128 keys. | | `resource` | | Flat string map describing the source (host, version, region). Searchable as `resource.:value`. | Unknown top-level fields, and body keys other than `message` and `fields`, are dropped. Put structured data in `fields` and anything you want to filter on in `attrs`. ## Responses A `202` means the events were durably queued. They are searchable within seconds, and visible in live tail sooner. ```json { "accepted": 9, "rejected": [{ "index": 3, "field": "trace_id", "message": "..." }], "quota": { "used_ratio": 0.83, "state": "warning" } } ``` - `rejected` lists events refused one by one. The rest were stored. - `quota` appears once the workspace has used 80% of its monthly ingest. | Status | Code | What to do | |---|---|---| | `400` | `INVALID_REQUEST` | Fix the request; every event in it was invalid. | | `401` | `UNAUTHENTICATED` | Check the token, and that it is an ingest token. | | `413` | `PAYLOAD_TOO_LARGE` | Split the batch: at most 5,000 events and 5 MiB decompressed. | | `421` | `WRONG_REGION` | Send to the host in the response's `endpoint` field. | | `429` | `RATE_LIMITED` or `QUOTA_EXCEEDED` | Wait for `Retry-After` seconds. | | `503` | `UNAVAILABLE` | Nothing was stored. Retry after `Retry-After`. | > **Note: Retries are safe** > > Writes are idempotent. Retry with the same `Idempotency-Key` (up to 128 characters) within 2 hours, or with the same event `id`s, and nothing is stored twice. ## Next - [Limits and batching](/send/limits): sizes, rates and quota behaviour. - [Other languages](/send/other-languages): Python, Go, Ruby and PHP examples. - [Search syntax](/explore/search-syntax): how to find what you sent. === # OpenTelemetry > Point any OpenTelemetry SDK or Collector at ZevSight's OTLP/HTTP logs endpoint with an ingest token. Source: https://docs.zevsight.com/send/opentelemetry `POST https://ingest.zevsight.com/v1/ingest/otlp/logs` ZevSight accepts standard OTLP/HTTP log exports (`ExportLogsServiceRequest`), as protobuf or JSON. Responses follow the OTLP/HTTP spec, including `partial_success`. > **Note** > > Only **logs** are accepted over OTLP today. Do not configure trace or metric exporters against ZevSight. ## SDK environment variables Any OpenTelemetry SDK reads these: ```bash OTEL_SERVICE_NAME=api OTEL_RESOURCE_ATTRIBUTES=deployment.environment=production OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://ingest.zevsight.com/v1/ingest/otlp/logs OTEL_EXPORTER_OTLP_LOGS_HEADERS="Authorization=Bearer " OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf ``` ## Collector Add ZevSight as a logs exporter: ```yaml exporters: otlphttp/zevsight: logs_endpoint: https://ingest.zevsight.com/v1/ingest/otlp/logs headers: Authorization: "Bearer ${env:ZEVSIGHT_INGEST_KEY}" service: pipelines: logs: receivers: [otlp] exporters: [otlphttp/zevsight] ``` ## How OTLP maps to ZevSight | OTLP | ZevSight | |---|---| | Resource `service.name` | `service` | | Resource `deployment.environment.name` (or `deployment.environment`) | `environment` | | Other resource attributes | `resource` | | Log record attributes | `attrs` | | Severity number or text | `severity` | | Trace and span ids | `trace_id`, `span_id` | The same limits apply as for the [HTTP ingest API](/send/limits). === # Node.js SDK > Send logs and heartbeats from Node.js with @zevsight/node, as a pino transport or a small client. Source: https://docs.zevsight.com/send/nodejs `@zevsight/node` sends logs and heartbeats from Node.js 18 or newer. Logging never blocks your code and never throws into it. Lines are batched, gzip-compressed and retried with backoff. Each line gets its id when it is logged, so a retried batch is stored once. ```bash npm install @zevsight/node ``` Set the ingest token in the environment: ```bash ZEVSIGHT_INGEST_KEY= ``` ## pino and nestjs-pino Add ZevSight as a transport target. Keep stdout as well if you like. ```js export const logger = pino({ transport: { targets: [ { target: 'pino/file', options: { destination: 1 } }, // keep stdout { target: '@zevsight/node/pino', options: { apiKey: process.env.ZEVSIGHT_INGEST_KEY, service: 'api', environment: 'production' }, }, ], }, }); ``` With nestjs-pino, put the same `transport` in `LoggerModule.forRoot({ pinoHttp: { transport } })`. Moving from `@logtail/pino`? Replace its target with `@zevsight/node/pino` and pass `apiKey`; nothing else in your logger changes. How pino fields are mapped: | pino | ZevSight | |---|---| | `level` | severity (`trace` … `fatal`) | | `time` | event time | | `msg` | message (the error's message if there is no `msg`) | | `err` | `fields.err` with type, message and stack | | `hostname`, `pid` | resource `host.name`, `process.pid` | | `req`, `res` | attributes `req.method`, `req.url`, `res.statusCode` … (nested objects such as headers go to fields) | | `trace_id`, `span_id` | the event's trace and span ids | | other flat values (`context`, `responseTime`) | attributes, searchable as `attrs.context:HTTP` | | other objects and arrays | fields | If you renamed pino's keys, pass `messageKey` or `errorKey` in the target's options. ## Client ```js const zevsight = new ZevSight({ service: 'billing-worker' }); // key from ZEVSIGHT_INGEST_KEY zevsight.info('invoice sent', { invoiceId: 'inv_42', amount: 1200 }); zevsight.error('payment failed', { provider: 'card' }); zevsight.log({ message: 'checkout completed', severity: 'info', attrs: { route: '/v1/checkout' }, // flat, searchable fields: { cart: { items: 3 } }, // structured traceId: '4bf92f3577b34da6a3ce929d0e0e4736', }); await zevsight.close(); // flush before a short-lived script exits ``` Methods: `log(event)`, `trace`, `debug`, `info`, `warn`, `error`, `fatal` (each takes `message, attrs`), `flush()` and `close(timeoutMs?)`. ## Heartbeats Create a [heartbeat monitor](/monitor/heartbeats) and copy its ping URL. ```js // Wrap a job: start, then ok, or fail with the error's message. await withHeartbeat(process.env.ZEVSIGHT_HEARTBEAT_NIGHTLY_EXPORT, () => runNightlyExport()); // Or ping by hand. const hb = heartbeat(process.env.ZEVSIGHT_HEARTBEAT_QUEUE_WORKER); await hb.start(); await hb.ok('processed 120 jobs'); await hb.fail('disk full'); ``` Pings never throw. Each resolves to `true` when ZevSight recorded it. `heartbeat(url, { timeoutMs, retries })` defaults to a 10-second timeout and 2 retries. Notes can be up to 8 KiB. ## Configuration | Option | Environment variable | Default | |---|---|---| | `apiKey` | `ZEVSIGHT_INGEST_KEY` | none: nothing is sent, and a warning is printed once | | `service` | `ZEVSIGHT_SERVICE`, then `OTEL_SERVICE_NAME` | `unknown` | | `environment` | `ZEVSIGHT_ENVIRONMENT`, then `NODE_ENV` | `production` | | `region` | `ZEVSIGHT_REGION` | `eu` (`https://ingest.zevsight.com`) | | `endpoint` | `ZEVSIGHT_ENDPOINT` | the region's ingest host | | `resource` | | none; attached to every line (version, region…) | | `flushIntervalMs` | | `1000` | | `maxBatchEvents` | | `500` (max 5000) | | `maxBatchBytes` | | `1048576` | | `maxBufferEvents` | | `20000`; beyond this the oldest lines are dropped and counted | | `maxRetries` | | `10` | | `maxRetryAfterMs` | | 5 minutes; a longer `Retry-After` (monthly quota reached) gives the batch up | | `requestTimeoutMs` | | `15000` | | `handleExit` | | `true`: flush on `beforeExit`, `SIGTERM`, `SIGINT` | | `shutdownTimeoutMs` | | `5000` | | `onError(e)` | | prints at most one line per minute to stderr | | `onQuota(q)` | | none; called past 80% of the monthly quota | Service and environment names are made into slugs (`Checkout Service` becomes `checkout-service`). ## When things go wrong | Situation | Behaviour | |---|---| | ZevSight unreachable, 5xx, 408 | Retried with exponential backoff (0.5 s to 30 s, jittered) | | 429 or 503 with `Retry-After` | Waits exactly that long, unless longer than `maxRetryAfterMs` | | Some lines refused (too old for the project's retention, malformed) | The rest are stored; `onError` gets `{ kind: 'rejected', rejected }` | | Wrong key or wrong region | Not retried; `onError` gets `delivery_failed` (with the right `endpoint` for a region mismatch) | | Buffer full while offline | Oldest lines dropped; `onError` gets `{ kind: 'dropped' }` and the next batch carries `zevsight.dropped_events` | ## Shutdown - **pino transport:** pino closes the transport when your process exits, and the transport flushes what it holds first. - **Client:** with `handleExit` on, the client flushes on `beforeExit`, `SIGTERM` and `SIGINT`, for up to `shutdownTimeoutMs`. In a short-lived script, `await zevsight.close()` at the end. - A crash that kills the process (`SIGKILL`, out of memory) loses at most one flush interval of lines. === # Other languages > Send logs to the HTTP ingest API from shell, Python, Go, Ruby and PHP with the standard library only. Source: https://docs.zevsight.com/send/other-languages There is an official SDK for Node.js only. Every other language can use the [HTTP ingest API](/send/http-api) directly, or an [OpenTelemetry](/send/opentelemetry) logs exporter if you already use OpenTelemetry. Each example sends one batch with an `Idempotency-Key`, so retrying the same request is safe. In production, buffer lines and send them in batches of up to 5,000 events or 5 MiB, once a second or so. See [Limits and batching](/send/limits). All examples read the token from `ZEVSIGHT_INGEST_KEY`. ## Shell (curl) ```bash curl -fsS -X POST https://ingest.zevsight.com/v1/ingest/events \ -H "Authorization: Bearer $ZEVSIGHT_INGEST_KEY" \ -H "Content-Type: application/x-ndjson" \ --data-binary @- <<'NDJSON' {"service":"backup","environment":"production","type":"log","severity":"info","body":{"message":"backup started"}} {"service":"backup","environment":"production","type":"log","severity":"info","body":{"message":"backup finished"},"attrs":{"size_mb":"812"}} NDJSON ``` ## Python ```python import json, os, uuid, urllib.request events = [{ "service": "worker", "environment": "production", "type": "log", "severity": "error", "attrs": {"queue": "emails"}, "body": {"message": "job failed", "fields": {"job_id": 1234}}, }] req = urllib.request.Request( "https://ingest.zevsight.com/v1/ingest/events", data=json.dumps({"events": events}).encode(), headers={ "Authorization": "Bearer " + os.environ["ZEVSIGHT_INGEST_KEY"], "Content-Type": "application/json", "Idempotency-Key": str(uuid.uuid4()), }, method="POST", ) with urllib.request.urlopen(req, timeout=15) as res: print(res.status, json.load(res)) # 202 {'accepted': 1, 'rejected': []} ``` ## Go ```go package main import ( "bytes" "encoding/json" "fmt" "net/http" "os" "time" ) func main() { payload, _ := json.Marshal(map[string]any{ "events": []map[string]any{{ "service": "api", "environment": "production", "type": "log", "severity": "warn", "ts": time.Now().UTC().Format(time.RFC3339Nano), "attrs": map[string]string{"route": "/v1/pay"}, "body": map[string]any{"message": "slow upstream", "fields": map[string]any{"ms": 2300}}, }}, }) req, _ := http.NewRequest("POST", "https://ingest.zevsight.com/v1/ingest/events", bytes.NewReader(payload)) req.Header.Set("Authorization", "Bearer "+os.Getenv("ZEVSIGHT_INGEST_KEY")) req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", fmt.Sprintf("api-%d", time.Now().UnixNano())) res, err := (&http.Client{Timeout: 15 * time.Second}).Do(req) if err != nil { fmt.Fprintln(os.Stderr, err) return } defer res.Body.Close() fmt.Println(res.Status) // 202 Accepted } ``` ## Ruby ```ruby require "json" require "net/http" require "securerandom" uri = URI("https://ingest.zevsight.com/v1/ingest/events") body = { events: [{ service: "web", environment: "production", type: "log", severity: "info", attrs: { controller: "orders" }, body: { message: "order placed", fields: { order_id: 42 } } }] } res = Net::HTTP.post(uri, body.to_json, "Authorization" => "Bearer #{ENV.fetch('ZEVSIGHT_INGEST_KEY')}", "Content-Type" => "application/json", "Idempotency-Key" => SecureRandom.uuid) puts res.code # 202 ``` ## PHP ```php [[ 'service' => 'web', 'environment' => 'production', 'type' => 'log', 'severity' => 'error', 'attrs' => ['route' => '/checkout'], 'body' => ['message' => 'card declined', 'fields' => ['code' => 'do_not_honor']], ]]]); $ch = curl_init('https://ingest.zevsight.com/v1/ingest/events'); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_POSTFIELDS => $payload, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 15, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . getenv('ZEVSIGHT_INGEST_KEY'), 'Content-Type: application/json', 'Idempotency-Key: ' . bin2hex(random_bytes(16)), ], ]); $body = curl_exec($ch); echo curl_getinfo($ch, CURLINFO_HTTP_CODE), ' ', $body, PHP_EOL; // 202 {"accepted":1,...} ``` ## Docker containers (Vector) To ship every container's output without changing the apps, run [Vector](https://vector.dev) with an NDJSON HTTP sink: ```toml [sources.docker] type = "docker_logs" [transforms.zevsight_shape] type = "remap" inputs = ["docker"] source = ''' . = { "service": replace(string!(.container_name), r'^/', ""), "environment": "production", "type": "log", "severity": "info", "body": { "message": .message }, "attrs": { "image": .image, "stream": .stream } } ''' [sinks.zevsight] type = "http" inputs = ["zevsight_shape"] uri = "https://ingest.zevsight.com/v1/ingest/events" method = "post" encoding.codec = "json" framing.method = "newline_delimited" request.headers.Content-Type = "application/x-ndjson" auth.strategy = "bearer" auth.token = "${ZEVSIGHT_INGEST_KEY}" ``` ## Retry rules for your own client - Retry on network errors, `408`, `429`, `5xx`. Wait for `Retry-After` when it is present, otherwise back off exponentially. - Do not retry `400`, `401` or `413`. Fix the request instead. - On `421 WRONG_REGION`, switch to the host in the response's `endpoint` field. - Keep the same `Idempotency-Key` or event `id`s when you retry. === # Heartbeats from cron > Ping a ZevSight heartbeat URL from cron jobs, scripts and workers, with start, success and failure pings. Source: https://docs.zevsight.com/send/heartbeats A heartbeat monitor expects a ping at least once per interval. If a ping is late, or a job reports a failure, ZevSight raises an alert. Create the monitor first (see [Heartbeats](/monitor/heartbeats)) and copy its ping URL. It looks like this: ```text https://ingest.zevsight.com/h/ ``` The token in the URL is the credential. No header is needed. Treat the URL as a secret: anyone who has it can send pings. ## Ping routes | Route | Meaning | |---|---| | `GET` or `POST /h/` | Success. | | `GET` or `POST /h//start` | The job started. The next success or failure ping records how long it ran. | | `GET` or `POST /h//fail` | The job failed. Alerts right away, without waiting for the grace period. | A `POST` body (plain text, up to 8 KiB) is stored as the ping's note: an exit code, a row count, an error. Longer notes are truncated, not refused. ## Cron Ping when the job succeeds: ```bash # m h dom mon dow command 0 3 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 https://ingest.zevsight.com/h/ > /dev/null ``` Report start, success and failure, with the exit code as the note: ```bash #!/usr/bin/env bash URL=https://ingest.zevsight.com/h/ curl -fsS -m 10 --retry 3 "$URL/start" > /dev/null /usr/local/bin/backup.sh code=$? if [ $code -eq 0 ]; then curl -fsS -m 10 --retry 3 "$URL" > /dev/null else curl -fsS -m 10 --retry 3 --data "exit $code" "$URL/fail" > /dev/null fi exit $code ``` ## Node.js ```js await withHeartbeat(process.env.ZEVSIGHT_HEARTBEAT_URL, () => runNightlyExport()); ``` See [Node.js SDK](/send/nodejs#heartbeats). ## Python ```python import os, urllib.request url = os.environ["ZEVSIGHT_HEARTBEAT_URL"] try: run_job() urllib.request.urlopen(url, timeout=10) except Exception as e: urllib.request.urlopen(urllib.request.Request(url + "/fail", data=str(e)[:8000].encode(), method="POST"), timeout=10) raise ``` ## Responses | Status | Meaning | |---|---| | `200` | Recorded. Body `OK`. | | `404` `NOT_FOUND` | No monitor has this URL. It may have been rotated or deleted. | | `421` `WRONG_REGION` | The monitor lives in another region's ingest host. | | `429` `RATE_LIMITED` | More than 2 pings a second for this monitor (bursts of 10 are fine). Wait for `Retry-After`. | | `503` `UNAVAILABLE` | Try again after `Retry-After`. | Pings are accepted at every quota level and in every subscription state, so a full monthly log quota never silences your cron alerts. A paused monitor still records pings but raises nothing. Rotating a monitor's token in the dashboard stops the old URL at once. Update your jobs at the same time. === # Limits and batching > Request, event and field size limits for ingest, rate limits and the monthly quota, and how to batch efficiently. Source: https://docs.zevsight.com/send/limits These limits are the same on every plan. Plan-dependent limits, such as monthly ingest volume and retention, are on the dashboard's **Billing** and **Usage** pages. See [Billing and plans](/workspace/billing). ## Per request | Limit | Value | |---|---| | Events per request | 5,000 | | Request size | 5 MiB after decompression | | Compression | `Content-Encoding: gzip` | | `Idempotency-Key` | Up to 128 characters, remembered for 2 hours | Over either limit, the whole request is refused with `413 PAYLOAD_TOO_LARGE`. ## Per event | Limit | Value | Over the limit | |---|---|---| | Event size | 256 KiB | The event is rejected (listed in `rejected`) | | `body.message` | 64 KiB | Truncated, marked `zs.truncated=message` | | Keys in `attrs` and in `resource` | 128 each | Extra keys dropped, counted in `zs.dropped_attrs` | | Attribute key length | 128 bytes | Dropped | | Attribute value length | 8 KiB | Truncated | | `service`, `environment` | Slug, up to 64 characters | Turned into a slug | | Event time `ts` | Up to 7 days in the past, 10 minutes in the future | Replaced by the receive time; original kept as `zs.original_ts` | | Age | Within the project's retention | Rejected | Keys starting with `zs.` are reserved for ZevSight. Invalid UTF-8 is replaced with U+FFFD. ## Rates and quota - **Burst.** Each workspace has an events-per-second burst limit set by its plan. Over it, ingest answers `429 RATE_LIMITED` with `Retry-After`. - **Monthly ingest.** Counted per workspace per UTC calendar month, on the stored size of events (decimal GB). - At 80%, owners and admins are emailed, the dashboard shows a banner, and ingest responses carry a `quota` object. - On the free plan or a trial, at 100% logs are refused with `429 QUOTA_EXCEEDED`, with `Retry-After` set to the start of next month. - On paid plans, logs are accepted up to 125%. From 125% to 150% only `warn` and above are accepted (`quota.state` is `warn_and_above_only`). Above 150% logs are refused. - Heartbeat pings and uptime check results are always accepted, whatever the quota. ## Batching - Send batches, not single lines. A good default is to flush every second, or at 500 events or 1 MiB, whichever comes first. The [Node.js SDK](/send/nodejs) does exactly this. - Compress with gzip. Logs usually shrink five to ten times. - Give every event an `id` (UUIDv7), or every batch an `Idempotency-Key`, so retries never duplicate. - Buffer while offline, with a cap, and drop the oldest lines first. - Respect `Retry-After` on `429` and `503`. === # Logs explorer > Search, filter and read your logs in the ZevSight dashboard, with the query bar, time range, histogram, columns and event panel. Source: https://docs.zevsight.com/explore/logs The explorer is the **Logs** page of the dashboard. It searches the projects and environments you pick, over a time range, with a [query](/explore/search-syntax). ## Scope and time range - **Scope.** Pick one project, several, or all, and optionally some environments. Press `p` to open the picker. Projects in another data region are not searched, and a notice says so. - **Time range.** Presets are 5m, 15m (the default), 1h, 6h, 24h, 7d, 30d, Today and Yesterday. You can also type a duration such as `90m`, `36h`, `14d` or `2w`, or pick an absolute range. The picker stops at the longest retention among the projects in scope. Everything about the view is in the URL, so the address bar is the link to share. ## The query bar Type a [query](/explore/search-syntax) and press `Enter`. As you type: - `Tab` accepts a suggestion. `↓` or `Ctrl+Space` opens the suggestions. - A `field:value` followed by a space becomes a chip. A second value for the same field merges into an OR list. - `Backspace` in an empty bar removes the last chip. `⌘⌫` clears the bar. - `⌥/` switches to editing the raw text. `Esc` closes suggestions, then leaves the bar. ## Histogram The chart above the list shows event volume over the range, stacked by level. Drag across it to zoom into that range. Click a bar to jump the list to that moment. ## The list Results are newest first. Scroll up for older lines; more pages load as you go. If a search reaches your plan's scan limit, the explorer says "stopped at your plan's scan limit". Narrow the range or the query to see everything. The status bar shows how many rows were scanned and how long it took. - **Columns.** Add any field or attribute as a column from the Columns menu or the event panel. - **Wrap.** Toggle wrapping. Wrapped lines show up to three lines. - **Density.** Compact or comfortable rows. - **N errors.** A shortcut that adds `level:>=error`. ## Event panel Press `Enter` on a line, or click it, to open the event panel. It shows the full message, the event fields, attributes and resource (sorted), and the body as JSON. Each value has buttons to **filter**, **exclude**, **add as a column** and **copy**. **Copy as JSON** copies the whole event. **Lines around this** sets the range to 30 seconds either side of the line and filters to its service. The API equivalent is [`GET /v1/query/logs/{event_id}/context`](/api/reference/query#lines-around-an-event), which also keeps the same environment. ## Keyboard | Key | Action | |---|---| | `/` | Focus search | | `p` | Scope picker | | `f` | Facets | | `t` | Switch Lines and Patterns | | `j` / `k` | Next / previous line | | `Enter` | Open line | | `Esc` | Close | | `Space` | Pause or resume live tail | | `End` | Jump to newest | | `[` / `]` | Previous / next error | | `L` | Live on or off | | `⌘K` / `Ctrl+K` | Command menu | Single-key shortcuts do nothing while you are typing in a field. ## See also - [Live tail](/explore/live-tail) - [Saved views](/explore/saved-views) - [Patterns and facets](/explore/patterns-and-facets) === # Search syntax > The ZevSight query language for log search, live tail and log alert rules, with fields, levels, phrases, attributes, OR lists and negation. Source: https://docs.zevsight.com/explore/search-syntax The same query language is used in the explorer's query bar, the `q` parameter of the [Query API](/api/reference/query), [live tail](/explore/live-tail) filters and [log alert rules](/respond/alerts#log-rules). A query is at most 2,000 characters. ```text service:api env:production level:>=warn "connection reset" attrs.route:/v1/* -attrs.user_id:42 ``` ## How terms combine - A query is a list of **terms** separated by spaces. **Every term must match**: terms are ANDed. - There are no `AND`, `OR` or `NOT` keywords, no parentheses and no regular expressions. - For OR, put several values in **one field term**, separated by commas: `service:auth,api`. - A leading `-` negates any term: `-debug`, `-service:auth,api` (neither), `-"connection reset"`. ## Free text Bare words and quoted phrases match the **log message** only. | Query | Matches | |---|---| | `timeout` | Messages containing the whole word `timeout`. `time` does not match `timeout`. | | `"connection reset"` | Messages containing that exact phrase, in that order. | | `payment failed` | Messages containing both words, anywhere. | | `-healthcheck` | Messages without the word `healthcheck`. | - Words are matched as whole tokens, case-insensitively (ASCII letters). - A phrase with several words or punctuation must also appear as an exact substring, ignoring case. `"reset connection"` does not match `Connection RESET`. - `*` in free text is a literal character, not a wildcard. - Text made only of punctuation, such as `"..."`, is an error. ## Fields | Field | Example | Notes | |---|---|---| | `service:` | `service:checkout` | Case-insensitive. | | `env:` or `environment:` | `env:production,staging` | Case-insensitive. | | `level:` or `severity:` | `level:error`, `level:>=warn` | See [Levels](#levels). | | `trace:` | `trace:4bf92f3577b34da6a3ce929d0e0e4736` | Exact trace id, case-insensitive. | | `type:` | `type:log`, `type:heartbeat,check_result` | `log`, `heartbeat`, `check_result`. Case-sensitive. | | `attrs.:` | `attrs.route:/v1/pay` | Exact, **case-sensitive**. `*` is a wildcard. | | `resource.:` | `resource.host.name:web-1` | Exact, case-sensitive. `*` is a wildcard. | - An empty value (`service:`) is an error. - An unknown field name, such as `host:web-1`, is treated as free text. - Attribute keys are flat. `attrs.user.id` looks up the key `user.id`, as sent by loggers that flatten nested objects. - A missing attribute reads as an empty value. So `attrs.x:*` matches every event, and there is no "field exists" test. > **Warning: Values cannot contain spaces** > > A field value ends at the first space, and quoted field values such as `attrs.who:"Ada Obi"` are refused. Match part of the value with a wildcard (`attrs.who:Ada*`) or search the message text instead. ### Lists and wildcards - `level:error,fatal`, `type:log,heartbeat`, `attrs.route:/v1/pay,/v1/cart`: any of the values. - A value with `*` is a wildcard and can be mixed into a list: `attrs.route:/v1/*,/v2/pay`. - At most 50 values per term. Empty values (`service:a,,b`) are an error. - `\,` is a literal comma and `\\` a literal backslash. ## Levels Levels in order: `trace` < `debug` < `info` < `warn` < `error` < `fatal`. | Query | Matches | |---|---| | `level:error` | Exactly `error` | | `level:error,fatal` | `error` or `fatal` | | `level:>=warn` | `warn`, `error`, `fatal` | | `level:=`, `<=`, `>` and `<`, and work only on `level`. They cannot be combined with a list: `level:>=warn,error` is an error. - Common logger spellings are accepted: `warning`, `err`, `crit`, `critical`, `panic`, `notice`, `verbose`, `dbg` and others. - Events with no level (heartbeat pings, check results) count as below `trace`, so `level:<=info` includes them. ## Examples ```text service:api env:production level:>=error "payment provider timeout" -env:development service:checkout attrs.route:/v1/pay level:>=warn trace:4bf92f3577b34da6a3ce929d0e0e4736 type:heartbeat attrs.monitor:nightly-export resource.host.name:web-1 -level:debug attrs.status:5* service:auth,api -"health check" ``` ## Errors An invalid query returns `400 INVALID_REQUEST` with a message saying what is wrong, for example `attrs.who: needs a value`. Common causes: an unclosed quote, an unknown level (`level:loud`), an empty value, an unknown `type`, or a list with a level comparison. === # Live tail > Follow matching log lines as they arrive, in the dashboard or over the /v1/tail WebSocket, with pause, resume and catch-up. Source: https://docs.zevsight.com/explore/live-tail Live tail streams lines that match your scope and query within moments of arriving at ZevSight. ## In the dashboard - Live is on by default for relative ranges (except Yesterday). Press `L` to turn it on or off. Turning it on with an absolute range switches the range to the last 15 minutes. - Live runs on the **Lines** tab only. - **Follow.** The list follows the newest line. Scroll up to stop following without pausing the stream. A "↓ N new lines" pill appears; press `End` or the pill to return. - **Pause.** Press `Space`. While paused, the control shows how many new lines arrived. Resume catches up from where you paused, so nothing is skipped. - If lines arrive faster than the browser can show, the explorer says "Showing a sample" with the rate. Pause, or narrow the query, to see every line. The skipped lines are stored; search for them. - The dashboard reconnects on its own if the connection drops, and catches up from the newest line it has. ## Over the API `WS wss://eu.zevsight.com/v1/tail` Open a WebSocket with the subprotocol `zevsight.tail.v1`. Do not put the credential in the URL. Send it in the first frame. ```js const ws = new WebSocket('wss://eu.zevsight.com/v1/tail', 'zevsight.tail.v1'); ws.onopen = () => { ws.send(JSON.stringify({ type: 'auth', token: '' })); ws.send(JSON.stringify({ type: 'subscribe', projects: ['all'], q: 'service:api level:>=error' })); }; ws.onmessage = (m) => { const f = JSON.parse(m.data); if (f.type === 'lines') f.lines.forEach((e) => console.log(e.ts, e.body?.message)); }; ``` ### Client frames | Frame | When | |---|---| | `{"type":"auth","token":""}` | First, within 5 seconds, or the socket closes with `4401`. Any API key (`zsr_…`) can tail. | | `{"type":"subscribe","projects":["all"],"q":"…","environments":["production"],"resume_from":""}` | Starts the stream, or replaces the filter. `q` uses the [search syntax](/explore/search-syntax). | | `{"type":"pause"}`, `{"type":"resume"}` | Pause and resume. Resume catches up from the last line sent. | Each client frame is at most 64 KiB. ### Server frames | Frame | Meaning | |---|---| | `lines` | Up to 500 events, sent at least every 75 ms while lines match. | | `caught_up` | Sent after every subscribe, once the catch-up is done. | | `lagging` | You are not keeping up. `skipped` lines were left out; search from `resume_from` to fill the gap. | | `error` | `{code, message}`, then the socket closes. One exception: `UNAVAILABLE` right after a subscribe means the catch-up failed, and the socket keeps streaming new lines. | ### Resume after a disconnect Subscribe with `resume_from` set to the `received_at` of the newest line you have. The server sends lines from 2 seconds before it, to absorb clock differences, so drop lines whose `id` you already have. The catch-up covers at most 10,000 lines. Beyond that you get `lagging` with `skipped: -1`; fetch the rest with [search](/api/reference/query). ### Close codes | Code | Meaning | |---|---| | `4400` | Invalid subscribe: bad filter or unknown frame | | `4401` | Not authenticated, or the key was revoked (keys are rechecked every second) | | `4403` | A project in the subscribe is not readable with this key | | `4408` | Session expired | | `4429` | Too many live tails open for the workspace (the limit is 50) | Full frame schemas: [Live tail API reference](/api/reference/live-tail). === # Saved views > Save an explorer search with its scope, query, columns and relative time range, keep it private or share it with the workspace. Source: https://docs.zevsight.com/explore/saved-views A saved view stores a search so you and your team can come back to it. ## What is saved - Name (up to 80 characters) - Projects (or all) and environments - The query, up to 2,000 characters - Columns (up to 30) - The time range, **only if it is relative**, such as "last 1h" Wrap, the open tab, live on or off, and absolute ranges are not saved. ## Save and update In the explorer, open the **Views** menu and choose **Save**, or press `⌘K` and pick "Save current view…". When you change a view you opened, the menu marks it with a dot and offers **Update**. The same menu has search, **Starred**, **Recent** (the last five), **Rename**, **Share** and **Delete**. Your first five starred views also appear in the sidebar. The **Views** page lists every view you can see, with the filters All, Starred, Mine and Shared, and lets you **Duplicate** a view. ## Sharing | | Private | Shared with the workspace | |---|---|---| | Who sees it | Only you | Every member | | Who can edit or delete | You | Members, admins and owners | | Who can change sharing | The creator | The creator | New views are shared by default in the save dialog. Viewers can save private views only. A workspace can have up to 200 saved views. === # Patterns and facets > Group log lines by message template with patterns, and break results down by service, environment, level, type and attributes with facets. Source: https://docs.zevsight.com/explore/patterns-and-facets ## Patterns The **Patterns** tab (press `t`) groups log lines whose messages differ only in their variable parts. It answers "what kinds of lines are these?" faster than scrolling. Varying parts become placeholders: | Placeholder | Replaces | |---|---| | `` | UUIDs | | `