Request
- Base URL: https://us.posthog.com
- URL: https://us.posthog.com/api/projects/{project_id}/logs/metric_rules/{id}/
- Auth: HTTP bearer
Path parameters
A UUID string identifying this logs metric rule.
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request body
Unique identifier for this metric rule.
User-visible label for this rule.
Name of the generated metric as it appears in the Metrics product. Must start with a letter and contain only letters, digits, dots, underscores, and dashes. Unique per project and immutable after creation — create a new rule to emit under a different name.
When true, ingestion evaluates this rule against every log record. At most 10 rules can be enabled per project.
Attribute key holding a numeric value to aggregate into a distribution (count + sum), e.g. attributes.duration_ms or resource_attributes.batch.size, prefixed with attributes. / resource_attributes.. For source=spans rules, the span pseudo-key duration_ms (span wall-clock duration) is also allowed. Omit to count matching records instead. Immutable after creation — it determines the emitted metric type.
Up to 5 dimension keys; each distinct value combination becomes its own metric series. For source=logs rules allowed: service_name, severity_text, event_name; for source=spans rules allowed: service_name, name, status_code, kind; for either, map keys prefixed with attributes. / resource_attributes.. Avoid high-cardinality keys (user IDs, request IDs) — excess series are dropped at ingestion. For source=spans rules, note that name is high-cardinality on poorly instrumented services (route params or SQL fragments in the span name), so grouping by name can overflow the per-rule series cap on its own.
- logs - Logs
- spans - Spans
Incremented on each update for worker cache coherency.
Response
Unique identifier for this metric rule.
User-visible label for this rule.
Name of the generated metric as it appears in the Metrics product. Must start with a letter and contain only letters, digits, dots, underscores, and dashes. Unique per project and immutable after creation — create a new rule to emit under a different name.
When true, ingestion evaluates this rule against every log record. At most 10 rules can be enabled per project.
Attribute key holding a numeric value to aggregate into a distribution (count + sum), e.g. attributes.duration_ms or resource_attributes.batch.size, prefixed with attributes. / resource_attributes.. For source=spans rules, the span pseudo-key duration_ms (span wall-clock duration) is also allowed. Omit to count matching records instead. Immutable after creation — it determines the emitted metric type.
Up to 5 dimension keys; each distinct value combination becomes its own metric series. For source=logs rules allowed: service_name, severity_text, event_name; for source=spans rules allowed: service_name, name, status_code, kind; for either, map keys prefixed with attributes. / resource_attributes.. Avoid high-cardinality keys (user IDs, request IDs) — excess series are dropped at ingestion. For source=spans rules, note that name is high-cardinality on poorly instrumented services (route params or SQL fragments in the span name), so grouping by name can overflow the per-rule series cap on its own.
- logs - Logs
- spans - Spans
Incremented on each update for worker cache coherency.
Changes
No recorded changes to this operation across all 1 revision of this API.