{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://logapi.com/assets/data/logapi-event-schema.json",
  "title": "LogAPI example event envelope",
  "description": "A compact teaching schema. Not an OTLP message or a hosted API contract. Apply a per-event attribute allowlist before production use.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "event_id",
    "timestamp",
    "event_name",
    "severity",
    "service",
    "attributes"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "1.0"
    },
    "event_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "timestamp": {
      "type": "string",
      "format": "date-time"
    },
    "event_name": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$",
      "maxLength": 128
    },
    "severity": {
      "type": "string",
      "enum": [
        "TRACE",
        "DEBUG",
        "INFO",
        "WARN",
        "ERROR",
        "FATAL"
      ]
    },
    "service": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "message": {
      "type": "string",
      "maxLength": 1024
    },
    "attributes": {
      "type": "object",
      "maxProperties": 32,
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9_]*$",
        "maxLength": 64
      },
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean",
          "null"
        ],
        "maxLength": 1024
      }
    }
  }
}
