BETA
Skip to content

Quickstart

Send your first log entry and search for it in under five minutes. This guide walks you through creating a log project, ingesting a log entry, and searching your logs.

Prerequisites

  • A Krafter account (invite-only -- request access at app.krafter.dev)
  • An API key with logs:write scope

Step 1: Create a Log Project

Create a project to organize your logs. The response includes an ingest_token that you will use to send log entries.

bash
curl -X POST https://app.krafter.dev/api/v1/logs/projects \
  -H "Authorization: Bearer kr_live_abc123def456" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My App",
    "description": "Production logs for my application",
    "retention_days": 30
  }'
json
{
  "data": {
    "id": "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
    "name": "My App",
    "description": "Production logs for my application",
    "retention_days": 30,
    "daily_limit_mb": null,
    "ingest_token_prefix": "krl_live_kp7",
    "ingest_token": "krl_live_kp7tx2bm4qrs6vwy3jnh5zfd7acmeg2j",
    "created_at": "2025-01-15T10:00:00Z",
    "updated_at": "2025-01-15T10:00:00Z"
  }
}

TIP

Save the ingest_token from the response — it's only returned once on create and rotation. You will need it in the next step to send logs. This token is different from your team API key.

Step 2: Send Your First Log

Use the ingest token (not your team API key) to send a log entry:

bash
curl -X POST https://app.krafter.dev/api/v1/logs/ingest \
  -H "Authorization: Bearer krl_live_kp7tx2bm4qrs6vwy3jnh5zfd7acmeg2j" \
  -H "Content-Type: application/json" \
  -d '{
    "level": "info",
    "message": "User signed in successfully",
    "stream": "auth",
    "service": "api-server",
    "metadata": {
      "user_id": "usr_42",
      "ip": "203.0.113.1"
    }
  }'
json
// 202 Accepted
{
  "ok": true
}

WARNING

The ingest endpoint uses your project ingest token, not your team API key. Using the wrong token will return a 401 error.

Step 3: Search Your Logs

Search for the log entry you just sent using your team API key:

bash
curl "https://app.krafter.dev/api/v1/logs/search?project_id=a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d&q=signed+in" \
  -H "Authorization: Bearer kr_live_abc123def456"
json
{
  "data": [
    {
      "timestamp": "2025-01-15T10:01:23Z",
      "level": "info",
      "stream": "auth",
      "service": "api-server",
      "message": "User signed in successfully",
      "trace_id": null,
      "span_id": null,
      "metadata": {
        "user_id": "usr_42",
        "ip": "203.0.113.1"
      }
    }
  ]
}

Step 4: View Logs in the Dashboard

Open the Krafter dashboard at app.krafter.dev/logs to browse your logs with a visual interface. The dashboard provides real-time search, level filtering, stream selection, and log detail views.

Next Steps

Built by Krafter Studio