日志

安装 HTTP, NDJSON or OpenTelemetry

日志以 JSON 数组或 NDJSON 发送到 https://in.blipit.io/api/v1/logs,每个请求最多 1,000 行或 1 MB,支持 gzip,使用私密密钥或公钥。OpenTelemetry 日志 exporter 发送到 /v1/logs。每行包含 message 和 level,以及可选的 timestamp、service、environment、trace_id 和最多 50 个扁平 attributes。

1任意语言

sh
curl https://in.blipit.io/api/v1/logs \
  -H "Content-Type: application/json" \
  -H "X-Blipit-Key: <secret key>" \
  -d '[{"level":"info","message":"order placed","service":"api","attributes":{"order_id":42}}]'

2OpenTelemetry

ini
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://in.blipit.io/v1/logs
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/json
OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-blipit-key=<secret key>

3Node,批量发送

js
const lines = [];
const log = (level, message, attributes = {}) =>
  lines.push({ level, message, service: "api", timestamp: new Date().toISOString(), attributes });

setInterval(() => {
  if (lines.length === 0) return;
  fetch("https://in.blipit.io/api/v1/logs", {
    method: "POST",
    headers: { "Content-Type": "application/json", "X-Blipit-Key": process.env.BLIPIT_SECRET_KEY },
    body: JSON.stringify(lines.splice(0, 1000)),
  }).catch(() => {});
}, 2000).unref();

须知

  • 每月按大小计算的额度:Free 1 GB,Solo 5 GB,Team 20 GB,Scale 100 GB。超出后,新行会被丢弃直到下月,绝不计费。
  • 保留期:Free 3 天,Solo 14 天,Team 和 Scale 30 天。

遇到问题?发邮件至 support@blipit.io。每个项目的密钥和确切的 DSN 在 app.blipit.io 的“API 密钥”下。