{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/statoss-com/json-schema/statoss-com-log-alert-schema.json",
  "title": "LogAlert",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/statoss-com-openapi.json#/components/schemas/LogAlert",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The rule id."
    },
    "appId": {
      "type": "string",
      "description": "The app whose lines it counts."
    },
    "name": {
      "type": "string",
      "description": "The rule's name, up to 80 characters."
    },
    "pageId": {
      "type": "string",
      "description": "The page whose on-call takes its alerts: a status page, or the app's project's on-call page. A new rule takes the app's page unless given, else the key's, else its project's on-call, made with the first rule when the project has no status page."
    },
    "enabled": {
      "type": "boolean",
      "description": "Off keeps the rule without checking it."
    },
    "query": {
      "type": "string",
      "description": "The lines it counts: the Logs search; empty for every line."
    },
    "kind": {
      "type": "string",
      "description": "match: at least threshold lines in the window; fewer: fewer than threshold; absent: no line at all.",
      "enum": [
        "match",
        "fewer",
        "absent"
      ]
    },
    "threshold": {
      "type": "integer",
      "description": "Lines; not for absent.",
      "minimum": 1,
      "maximum": 100000000
    },
    "windowMinutes": {
      "type": "integer",
      "description": "The window the lines are counted over.",
      "minimum": 1,
      "maximum": 1440
    },
    "confirmMinutes": {
      "type": "integer",
      "description": "How long the condition holds before it fires; 0 is at once.",
      "minimum": 0,
      "maximum": 60
    },
    "recoverMinutes": {
      "type": "integer",
      "description": "How long it is false before the alert resolves; 0 is at once.",
      "minimum": 0,
      "maximum": 60
    },
    "environments": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "Environments a line must be in; empty for any."
      }
    },
    "ownRouting": {
      "type": "boolean",
      "description": "true sends to destinationIds and memberIds; false to where the page's alerts go."
    },
    "repeatMinutes": {
      "type": "integer",
      "description": "Minutes between repeats while triggered; 0 for none.",
      "enum": [
        0,
        1,
        2,
        5,
        10,
        15,
        30,
        60
      ]
    },
    "groupMinutes": {
      "type": "integer",
      "description": "Minutes in which later alerts join the first; 0 is off.",
      "enum": [
        0,
        2,
        5,
        10,
        30
      ]
    },
    "destinationIds": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "With ownRouting: the team's alert destinations."
      }
    },
    "memberIds": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "With ownRouting: people in the team to notify."
      }
    },
    "paging": {
      "type": "string",
      "description": "Who is paged: \"page\" (the page's escalation policy), \"none\", or the id of one of the team's policies. Escalation is on Pro."
    },
    "internal": {
      "type": "boolean",
      "description": "true when pageId is the project's on-call page, which is no status page."
    },
    "summary": {
      "type": "string",
      "description": "Its condition and search, in words."
    },
    "firing": {
      "type": "boolean",
      "description": "Whether its alert is open."
    },
    "waitingForLines": {
      "type": "boolean",
      "description": "fewer and absent: true until a check has found the condition false once (for absent, a line; for fewer, at least threshold lines). Until then the rule does not fire, so one made before its app sends anything waits for the first lines. Editing the search, kind or environments starts the wait again. False while the rule is firing, and always for match."
    },
    "lastCheckedAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "ISO 8601, UTC.",
      "format": "date-time"
    },
    "lastCount": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Lines in the window at the last check."
    },
    "lastFiredAt": {
      "type": [
        "string",
        "null"
      ],
      "description": "ISO 8601, UTC.",
      "format": "date-time"
    },
    "lastError": {
      "type": [
        "string",
        "null"
      ],
      "description": "What ClickHouse said when it refused the search; the rule is not checked until it is changed. A search too heavy to count is set apart for an hour and says so."
    },
    "searchUrl": {
      "type": "string",
      "description": "The Logs area at its search and window."
    },
    "createdAt": {
      "type": "string",
      "description": "ISO 8601, UTC.",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "description": "ISO 8601, UTC.",
      "format": "date-time"
    }
  }
}