Templates API¶
Template-level operations. Drain3 groups raw messages into log templates; the API exposes template statistics and priority overrides.
The templates endpoints live under
/api/logs/meta/…in thelogsrouter.
Endpoint Summary¶
| Method | Path | Description |
|---|---|---|
GET |
/api/logs/meta/templates |
Top templates by occurrence count |
PATCH |
/api/logs/{event_id}/priority |
Override an event's priority (propagates to template) |
Top Templates¶
| Query | Type | Default | Constraints |
|---|---|---|---|
limit |
int | 20 |
≤ 200 |
Returns templates ordered by occurrence_count descending:
[
{
"template_id": "a1b2c3d4-…",
"template": "Connection timeout connecting to {host}",
"occurrence_count": 482113,
"severity": "ERROR",
"priority": "P2",
"confidence": 0.92,
"model_version": "roberta-v3"
}
]
Override Event Priority (human correction)¶
Human corrections override the ML prediction and:
- Set the event's
priorityto the corrected value - Set
priority_confidence = 1.0andmodel_version = "manual" - Store
tags.correction_reason(≤ 200 chars) on the event - Propagate to
template_priorityso future events from the same template use the corrected priority - Invalidate the Redis cache key
ml:priority:{template_id}
| Field | Type | Required | Description |
|---|---|---|---|
priority |
string | yes | P1 – P4 |
reason |
string | no | Optional justification |
This feedback loop is what makes the Labeling Pipeline and priority correction workflow work.
Related¶
- Logs API — raw event listing and filters
- Drain3 Parser — how templates are generated
- Template Cache — priority cache layers