:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
/**
* Auto-generated Zod validation schemas from the Django backend OpenAPI schema.
* To modify these schemas, update the Django serializers or views, then run:
* hogli build:openapi
* Questions or issues? #team-devex on Slack
*
* PostHog API - generated
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
/**
* Manage logs product configuration for this project's canonical environment.
* Members can read; writing requires project admin, matching the admin-only
* settings UI. Mirrors the env-router action so /api/projects/:id/logs_config/
* resolves alongside the legacy /api/environments/:id/logs_config/ alias.
*/
export const organizationsProjectsLogsConfigPartialUpdateBodyLogsDistinctIdAttributeKeysItemMax = 200
export const organizationsProjectsLogsConfigPartialUpdateBodyLogsDistinctIdAttributeKeysMax = 10
export const organizationsProjectsLogsConfigPartialUpdateBodyLogsSessionIdAttributeKeysItemMax = 200
export const organizationsProjectsLogsConfigPartialUpdateBodyLogsSessionIdAttributeKeysMax = 10
export const organizationsProjectsLogsConfigPartialUpdateBodyLogsPatternMessageKeysItemMax = 200
export const organizationsProjectsLogsConfigPartialUpdateBodyLogsPatternMessageKeysMax = 10
export const OrganizationsProjectsLogsConfigPartialUpdateBody = /* @__PURE__ */ zod.object({
logs_distinct_id_attribute_keys: zod
.array(zod.string().max(organizationsProjectsLogsConfigPartialUpdateBodyLogsDistinctIdAttributeKeysItemMax))
.max(organizationsProjectsLogsConfigPartialUpdateBodyLogsDistinctIdAttributeKeysMax)
.optional()
.describe(
"Log attribute keys whose values should match a person's distinct_id — a log links to a person when any of these attributes equals one of their distinct IDs. Used by the person profile Logs tab and the `query-logs` MCP tool. Defaults to ['posthogDistinctId'] — the convention documented at https:\/\/posthog.com\/docs\/logs\/link-session-replay and the key the posthog-js \/ posthog-react-native SDKs auto-attach. Add keys only if your pipeline emits the person identifier under different attributes."
),
logs_session_id_attribute_keys: zod
.array(zod.string().max(organizationsProjectsLogsConfigPartialUpdateBodyLogsSessionIdAttributeKeysItemMax))
.max(organizationsProjectsLogsConfigPartialUpdateBodyLogsSessionIdAttributeKeysMax)
.optional()
.describe(
"Ordered list of log attribute keys whose values hold the PostHog session ID. Detection checks keys in order, then falls back to common session ID attribute conventions; the first key with a value wins. Defaults to ['sessionId'] — the convention documented at https:\/\/posthog.com\/docs\/logs\/link-session-replay and the key the posthog-js \/ posthog-react-native SDKs auto-attach. Add keys only if your pipeline emits the session ID under different attributes."
),
logs_pattern_message_keys: zod
.array(zod.string().max(organizationsProjectsLogsConfigPartialUpdateBodyLogsPatternMessageKeysItemMax))
.max(organizationsProjectsLogsConfigPartialUpdateBodyLogsPatternMessageKeysMax)
.optional()
.describe(
"Ordered list of top-level JSON keys whose value is the message text that log patterns are derived from. Keys are matched literally at the top level of the log body; a dot in a key is part of the key name, not a path into nested objects. Selection checks keys in order; the first key whose value is a non-empty string wins. Defaults to ['message', 'msg', 'event']. An empty list turns message extraction off, so JSON log bodies group by their key set instead. The stored log body is never changed by this setting."
),
})
export const logsAlertsCreateBodyNameMax = 255
export const logsAlertsCreateBodyEnabledDefault = true
export const logsAlertsCreateBodyThresholdCountDefault = 100
export const logsAlertsCreateBodyThresholdCountMin = 0
export const logsAlertsCreateBodyThresholdOperatorDefault = `above`
export const logsAlertsCreateBodyWindowMinutesDefault = 5
export const logsAlertsCreateBodyEvaluationPeriodsDefault = 1
export const logsAlertsCreateBodyEvaluationPeriodsMax = 10
export const logsAlertsCreateBodyDatapointsToAlarmDefault = 1
export const logsAlertsCreateBodyDatapointsToAlarmMax = 10
export const logsAlertsCreateBodyCooldownMinutesDefault = 0
export const logsAlertsCreateBodyCooldownMinutesMin = 0
export const logsAlertsCreateBodyGroupingOneMaxInstancesDefault = 100
export const logsAlertsCreateBodyGroupingOneMaxInstancesMax = 100
export const logsAlertsCreateBodyGroupingOneOnOverflowDefault = `degrade_visible`
export const LogsAlertsCreateBody = /* @__PURE__ */ zod.object({
name: zod
.string()
.max(logsAlertsCreateBodyNameMax)
.optional()
.describe("Human-readable name for this alert. Defaults to 'Untitled alert' on create when omitted."),
enabled: zod
.boolean()
.default(logsAlertsCreateBodyEnabledDefault)
.describe('Whether the alert is actively being evaluated. Disabling resets the state to not_firing.'),
filters: zod
.object({
filterGroup: zod
.union([
zod.object({
type: zod.enum(['AND', 'OR']),
values: zod.array(
zod
.record(zod.string(), zod.unknown())
.describe(
'Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)'
)
),
}),
zod.null(),
])
.optional(),
serviceNames: zod.union([zod.array(zod.string()), zod.null()]).optional(),
severityLevels: zod
.union([zod.array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])), zod.null()])
.optional(),
})
.optional()
.describe(
'Filter criteria — subset of LogsViewerFilters. Must contain at least one of: severityLevels (list of severity strings), serviceNames (list of service name strings), or filterGroup (property filter group object). May be empty on draft alerts (enabled=false).'
),
threshold_count: zod
.number()
.min(logsAlertsCreateBodyThresholdCountMin)
.default(logsAlertsCreateBodyThresholdCountDefault)
.describe(
"Number of matching log entries that constitutes a threshold breach within the evaluation window. Defaults to 100. Use 0 with the 'above' operator to fire on any matching log."
),
threshold_operator: zod
.enum(['above', 'below'])
.describe('\* `above` - Above\n\* `below` - Below')
.default(logsAlertsCreateBodyThresholdOperatorDefault)
.describe(
'Whether the alert fires when the count is above or below the threshold.\n\n\* `above` - Above\n\* `below` - Below'
),
window_minutes: zod
.number()
.default(logsAlertsCreateBodyWindowMinutesDefault)
.describe('Time window in minutes over which log entries are counted. Allowed values: 5, 10, 15, 30, 60.'),
evaluation_periods: zod
.number()
.min(1)
.max(logsAlertsCreateBodyEvaluationPeriodsMax)
.default(logsAlertsCreateBodyEvaluationPeriodsDefault)
.describe('Total number of check periods in the sliding evaluation window for firing (M in N-of-M).'),
datapoints_to_alarm: zod
.number()
.min(1)
.max(logsAlertsCreateBodyDatapointsToAlarmMax)
.default(logsAlertsCreateBodyDatapointsToAlarmDefault)
.describe('How many periods within the evaluation window must breach the threshold to fire (N in N-of-M).'),
cooldown_minutes: zod
.number()
.min(logsAlertsCreateBodyCooldownMinutesMin)
.default(logsAlertsCreateBodyCooldownMinutesDefault)
.describe(
'Minimum minutes between notifications. The alert notifies once when it starts firing and once when it resolves. It does not notify again on each check while it stays firing. A fire or resolve notification inside the cooldown is skipped. Cooldown does not apply to PagerDuty incidents. 0 means no minimum.'
),
schedule_restriction: zod
.union([
zod.object({
blocked_windows: zod
.array(
zod.object({
start: zod
.string()
.describe(
'Start time HH:MM (24-hour, project timezone). Inclusive. Each window must span ≥ 30 minutes on the local daily timeline (half-open [start, end)).'
),
end: zod
.string()
.describe(
'End time HH:MM (24-hour). Exclusive (half-open interval). Each window must span ≥ 30 minutes locally.'
),
})
)
.describe(
'Blocked local time windows when the alert must not run. Overlapping or identical windows are merged when saved. At most five windows before normalization; empty array clears quiet hours.'
),
}),
zod.null(),
])
.optional()
.describe(
'Blocked local time windows when the alert must not run. Times use the project timezone. Null disables quiet hours.'
),
snooze_until: zod.iso
.datetime({ offset: true })
.nullish()
.describe('ISO 8601 timestamp until which the alert is snoozed. Set to null to unsnooze.'),
grouping: zod
.object({
mode: zod
.enum(['single', 'by_result_labels'])
.describe('\* `single` - Single\n\* `by_result_labels` - By result labels')
.describe(
'single keeps one instance for the whole alert. by_result_labels keeps one instance per distinct value of the labels in keys, so each group fires and resolves on its own.\n\n\* `single` - Single\n\* `by_result_labels` - By result labels'
),
keys: zod
.array(zod.string())
.optional()
.describe(
'Result labels whose values make a group, such as service_name. Empty for mode single, required for by_result_labels. Changing them deletes the existing instances and closes their notification threads without a message.'
),
max_instances: zod
.number()
.min(1)
.max(logsAlertsCreateBodyGroupingOneMaxInstancesMax)
.default(logsAlertsCreateBodyGroupingOneMaxInstancesDefault)
.describe(
'Most instances the alert keeps at once. Groups past it are not tracked, and the last message says how many were left out.'
),
on_overflow: zod
.enum(['degrade_visible'])
.describe('\* `degrade_visible` - Degrade visible')
.default(logsAlertsCreateBodyGroupingOneOnOverflowDefault)
.describe(
'What happens to groups past max_instances. degrade_visible names how many were left out.\n\n\* `degrade_visible` - Degrade visible'
),
})
.describe('How a logs alert splits its results into instances.')
.optional()
.describe(
'How the alert splits its results into instances. Mode single keeps one instance for the whole alert. Mode by_result_labels with keys service_name and\/or severity_text keeps one instance per service or severity, each firing and resolving on its own, and needs threshold_operator above. Only an alert the alerts platform evaluates can group. Any other alert reads as single and rejects a different value. Omit it on update to keep the current grouping. Changing the keys deletes the existing instances and closes their notification threads without a message.'
),
})
export const logsAlertsUpdateBodyNameMax = 255
export const logsAlertsUpdateBodyEnabledDefault = true
export const logsAlertsUpdateBodyThresholdCountDefault = 100
export const logsAlertsUpdateBodyThresholdCountMin = 0
export const logsAlertsUpdateBodyThresholdOperatorDefault = `above`
export const logsAlertsUpdateBodyWindowMinutesDefault = 5
export const logsAlertsUpdateBodyEvaluationPeriodsDefault = 1
export const logsAlertsUpdateBodyEvaluationPeriodsMax = 10
export const logsAlertsUpdateBodyDatapointsToAlarmDefault = 1
export const logsAlertsUpdateBodyDatapointsToAlarmMax = 10
export const logsAlertsUpdateBodyCooldownMinutesDefault = 0
export const logsAlertsUpdateBodyCooldownMinutesMin = 0
export const logsAlertsUpdateBodyGroupingOneMaxInstancesDefault = 100
export const logsAlertsUpdateBodyGroupingOneMaxInstancesMax = 100
export const logsAlertsUpdateBodyGroupingOneOnOverflowDefault = `degrade_visible`
export const LogsAlertsUpdateBody = /* @__PURE__ */ zod.object({
name: zod
.string()
.max(logsAlertsUpdateBodyNameMax)
.optional()
.describe("Human-readable name for this alert. Defaults to 'Untitled alert' on create when omitted."),
enabled: zod
.boolean()
.default(logsAlertsUpdateBodyEnabledDefault)
.describe('Whether the alert is actively being evaluated. Disabling resets the state to not_firing.'),
filters: zod
.object({
filterGroup: zod
.union([
zod.object({
type: zod.enum(['AND', 'OR']),
values: zod.array(
zod
.record(zod.string(), zod.unknown())
.describe(
'Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)'
)
),
}),
zod.null(),
])
.optional(),
serviceNames: zod.union([zod.array(zod.string()), zod.null()]).optional(),
severityLevels: zod
.union([zod.array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])), zod.null()])
.optional(),
})
.optional()
.describe(
'Filter criteria — subset of LogsViewerFilters. Must contain at least one of: severityLevels (list of severity strings), serviceNames (list of service name strings), or filterGroup (property filter group object). May be empty on draft alerts (enabled=false).'
),
threshold_count: zod
.number()
.min(logsAlertsUpdateBodyThresholdCountMin)
.default(logsAlertsUpdateBodyThresholdCountDefault)
.describe(
"Number of matching log entries that constitutes a threshold breach within the evaluation window. Defaults to 100. Use 0 with the 'above' operator to fire on any matching log."
),
threshold_operator: zod
.enum(['above', 'below'])
.describe('\* `above` - Above\n\* `below` - Below')
.default(logsAlertsUpdateBodyThresholdOperatorDefault)
.describe(
'Whether the alert fires when the count is above or below the threshold.\n\n\* `above` - Above\n\* `below` - Below'
),
window_minutes: zod
.number()
.default(logsAlertsUpdateBodyWindowMinutesDefault)
.describe('Time window in minutes over which log entries are counted. Allowed values: 5, 10, 15, 30, 60.'),
evaluation_periods: zod
.number()
.min(1)
.max(logsAlertsUpdateBodyEvaluationPeriodsMax)
.default(logsAlertsUpdateBodyEvaluationPeriodsDefault)
.describe('Total number of check periods in the sliding evaluation window for firing (M in N-of-M).'),
datapoints_to_alarm: zod
.number()
.min(1)
.max(logsAlertsUpdateBodyDatapointsToAlarmMax)
.default(logsAlertsUpdateBodyDatapointsToAlarmDefault)
.describe('How many periods within the evaluation window must breach the threshold to fire (N in N-of-M).'),
cooldown_minutes: zod
.number()
.min(logsAlertsUpdateBodyCooldownMinutesMin)
.default(logsAlertsUpdateBodyCooldownMinutesDefault)
.describe(
'Minimum minutes between notifications. The alert notifies once when it starts firing and once when it resolves. It does not notify again on each check while it stays firing. A fire or resolve notification inside the cooldown is skipped. Cooldown does not apply to PagerDuty incidents. 0 means no minimum.'
),
schedule_restriction: zod
.union([
zod.object({
blocked_windows: zod
.array(
zod.object({
start: zod
.string()
.describe(
'Start time HH:MM (24-hour, project timezone). Inclusive. Each window must span ≥ 30 minutes on the local daily timeline (half-open [start, end)).'
),
end: zod
.string()
.describe(
'End time HH:MM (24-hour). Exclusive (half-open interval). Each window must span ≥ 30 minutes locally.'
),
})
)
.describe(
'Blocked local time windows when the alert must not run. Overlapping or identical windows are merged when saved. At most five windows before normalization; empty array clears quiet hours.'
),
}),
zod.null(),
])
.optional()
.describe(
'Blocked local time windows when the alert must not run. Times use the project timezone. Null disables quiet hours.'
),
snooze_until: zod.iso
.datetime({ offset: true })
.nullish()
.describe('ISO 8601 timestamp until which the alert is snoozed. Set to null to unsnooze.'),
grouping: zod
.object({
mode: zod
.enum(['single', 'by_result_labels'])
.describe('\* `single` - Single\n\* `by_result_labels` - By result labels')
.describe(
'single keeps one instance for the whole alert. by_result_labels keeps one instance per distinct value of the labels in keys, so each group fires and resolves on its own.\n\n\* `single` - Single\n\* `by_result_labels` - By result labels'
),
keys: zod
.array(zod.string())
.optional()
.describe(
'Result labels whose values make a group, such as service_name. Empty for mode single, required for by_result_labels. Changing them deletes the existing instances and closes their notification threads without a message.'
),
max_instances: zod
.number()
.min(1)
.max(logsAlertsUpdateBodyGroupingOneMaxInstancesMax)
.default(logsAlertsUpdateBodyGroupingOneMaxInstancesDefault)
.describe(
'Most instances the alert keeps at once. Groups past it are not tracked, and the last message says how many were left out.'
),
on_overflow: zod
.enum(['degrade_visible'])
.describe('\* `degrade_visible` - Degrade visible')
.default(logsAlertsUpdateBodyGroupingOneOnOverflowDefault)
.describe(
'What happens to groups past max_instances. degrade_visible names how many were left out.\n\n\* `degrade_visible` - Degrade visible'
),
})
.describe('How a logs alert splits its results into instances.')
.optional()
.describe(
'How the alert splits its results into instances. Mode single keeps one instance for the whole alert. Mode by_result_labels with keys service_name and\/or severity_text keeps one instance per service or severity, each firing and resolving on its own, and needs threshold_operator above. Only an alert the alerts platform evaluates can group. Any other alert reads as single and rejects a different value. Omit it on update to keep the current grouping. Changing the keys deletes the existing instances and closes their notification threads without a message.'
),
})
export const logsAlertsPartialUpdateBodyNameMax = 255
export const logsAlertsPartialUpdateBodyEnabledDefault = true
export const logsAlertsPartialUpdateBodyThresholdCountDefault = 100
export const logsAlertsPartialUpdateBodyThresholdCountMin = 0
export const logsAlertsPartialUpdateBodyThresholdOperatorDefault = `above`
export const logsAlertsPartialUpdateBodyWindowMinutesDefault = 5
export const logsAlertsPartialUpdateBodyEvaluationPeriodsDefault = 1
export const logsAlertsPartialUpdateBodyEvaluationPeriodsMax = 10
export const logsAlertsPartialUpdateBodyDatapointsToAlarmDefault = 1
export const logsAlertsPartialUpdateBodyDatapointsToAlarmMax = 10
export const logsAlertsPartialUpdateBodyCooldownMinutesDefault = 0
export const logsAlertsPartialUpdateBodyCooldownMinutesMin = 0
export const logsAlertsPartialUpdateBodyGroupingOneMaxInstancesDefault = 100
export const logsAlertsPartialUpdateBodyGroupingOneMaxInstancesMax = 100
export const logsAlertsPartialUpdateBodyGroupingOneOnOverflowDefault = `degrade_visible`
export const LogsAlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
name: zod
.string()
.max(logsAlertsPartialUpdateBodyNameMax)
.optional()
.describe("Human-readable name for this alert. Defaults to 'Untitled alert' on create when omitted."),
enabled: zod
.boolean()
.default(logsAlertsPartialUpdateBodyEnabledDefault)
.describe('Whether the alert is actively being evaluated. Disabling resets the state to not_firing.'),
filters: zod
.object({
filterGroup: zod
.union([
zod.object({
type: zod.enum(['AND', 'OR']),
values: zod.array(
zod
.record(zod.string(), zod.unknown())
.describe(
'Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)'
)
),
}),
zod.null(),
])
.optional(),
serviceNames: zod.union([zod.array(zod.string()), zod.null()]).optional(),
severityLevels: zod
.union([zod.array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])), zod.null()])
.optional(),
})
.optional()
.describe(
'Filter criteria — subset of LogsViewerFilters. Must contain at least one of: severityLevels (list of severity strings), serviceNames (list of service name strings), or filterGroup (property filter group object). May be empty on draft alerts (enabled=false).'
),
threshold_count: zod
.number()
.min(logsAlertsPartialUpdateBodyThresholdCountMin)
.default(logsAlertsPartialUpdateBodyThresholdCountDefault)
.describe(
"Number of matching log entries that constitutes a threshold breach within the evaluation window. Defaults to 100. Use 0 with the 'above' operator to fire on any matching log."
),
threshold_operator: zod
.enum(['above', 'below'])
.describe('\* `above` - Above\n\* `below` - Below')
.default(logsAlertsPartialUpdateBodyThresholdOperatorDefault)
.describe(
'Whether the alert fires when the count is above or below the threshold.\n\n\* `above` - Above\n\* `below` - Below'
),
window_minutes: zod
.number()
.default(logsAlertsPartialUpdateBodyWindowMinutesDefault)
.describe('Time window in minutes over which log entries are counted. Allowed values: 5, 10, 15, 30, 60.'),
evaluation_periods: zod
.number()
.min(1)
.max(logsAlertsPartialUpdateBodyEvaluationPeriodsMax)
.default(logsAlertsPartialUpdateBodyEvaluationPeriodsDefault)
.describe('Total number of check periods in the sliding evaluation window for firing (M in N-of-M).'),
datapoints_to_alarm: zod
.number()
.min(1)
.max(logsAlertsPartialUpdateBodyDatapointsToAlarmMax)
.default(logsAlertsPartialUpdateBodyDatapointsToAlarmDefault)
.describe('How many periods within the evaluation window must breach the threshold to fire (N in N-of-M).'),
cooldown_minutes: zod
.number()
.min(logsAlertsPartialUpdateBodyCooldownMinutesMin)
.default(logsAlertsPartialUpdateBodyCooldownMinutesDefault)
.describe(
'Minimum minutes between notifications. The alert notifies once when it starts firing and once when it resolves. It does not notify again on each check while it stays firing. A fire or resolve notification inside the cooldown is skipped. Cooldown does not apply to PagerDuty incidents. 0 means no minimum.'
),
schedule_restriction: zod
.union([
zod.object({
blocked_windows: zod
.array(
zod.object({
start: zod
.string()
.describe(
'Start time HH:MM (24-hour, project timezone). Inclusive. Each window must span ≥ 30 minutes on the local daily timeline (half-open [start, end)).'
),
end: zod
.string()
.describe(
'End time HH:MM (24-hour). Exclusive (half-open interval). Each window must span ≥ 30 minutes locally.'
),
})
)
.describe(
'Blocked local time windows when the alert must not run. Overlapping or identical windows are merged when saved. At most five windows before normalization; empty array clears quiet hours.'
),
}),
zod.null(),
])
.optional()
.describe(
'Blocked local time windows when the alert must not run. Times use the project timezone. Null disables quiet hours.'
),
snooze_until: zod.iso
.datetime({ offset: true })
.nullish()
.describe('ISO 8601 timestamp until which the alert is snoozed. Set to null to unsnooze.'),
grouping: zod
.object({
mode: zod
.enum(['single', 'by_result_labels'])
.describe('\* `single` - Single\n\* `by_result_labels` - By result labels')
.describe(
'single keeps one instance for the whole alert. by_result_labels keeps one instance per distinct value of the labels in keys, so each group fires and resolves on its own.\n\n\* `single` - Single\n\* `by_result_labels` - By result labels'
),
keys: zod
.array(zod.string())
.optional()
.describe(
'Result labels whose values make a group, such as service_name. Empty for mode single, required for by_result_labels. Changing them deletes the existing instances and closes their notification threads without a message.'
),
max_instances: zod
.number()
.min(1)
.max(logsAlertsPartialUpdateBodyGroupingOneMaxInstancesMax)
.default(logsAlertsPartialUpdateBodyGroupingOneMaxInstancesDefault)
.describe(
'Most instances the alert keeps at once. Groups past it are not tracked, and the last message says how many were left out.'
),
on_overflow: zod
.enum(['degrade_visible'])
.describe('\* `degrade_visible` - Degrade visible')
.default(logsAlertsPartialUpdateBodyGroupingOneOnOverflowDefault)
.describe(
'What happens to groups past max_instances. degrade_visible names how many were left out.\n\n\* `degrade_visible` - Degrade visible'
),
})
.describe('How a logs alert splits its results into instances.')
.optional()
.describe(
'How the alert splits its results into instances. Mode single keeps one instance for the whole alert. Mode by_result_labels with keys service_name and\/or severity_text keeps one instance per service or severity, each firing and resolving on its own, and needs threshold_operator above. Only an alert the alerts platform evaluates can group. Any other alert reads as single and rejects a different value. Omit it on update to keep the current grouping. Changing the keys deletes the existing instances and closes their notification threads without a message.'
),
})
/**
* Create a notification destination for this alert. One HogFunction is created per alert event kind (firing, resolved, ...) atomically. A PagerDuty destination gets the incident opened and incident closed kinds instead. They follow every start and end of a firing, cooldown included, so each incident it opens is resolved.
*/
export const logsAlertsDestinationsCreateBodyPagerdutySeverityDefault = `critical`
export const logsAlertsDestinationsCreateBodyPagerdutyRegionDefault = `us`
export const LogsAlertsDestinationsCreateBody = /* @__PURE__ */ zod.object({
type: zod
.enum(['slack', 'webhook', 'teams', 'pagerduty'])
.describe('\* `slack` - slack\n\* `webhook` - webhook\n\* `teams` - teams\n\* `pagerduty` - pagerduty')
.describe(
'Notification destination type.\n\n\* `slack` - slack\n\* `webhook` - webhook\n\* `teams` - teams\n\* `pagerduty` - pagerduty'
),
slack_workspace_id: zod
.number()
.optional()
.describe('Integration ID for the Slack workspace. Required when type=slack.'),
slack_channel_id: zod.string().optional().describe('Slack channel ID. Required when type=slack.'),
slack_channel_name: zod.string().optional().describe('Human-readable channel name for display.'),
webhook_url: zod.url().optional().describe('HTTPS endpoint to post to. Required for webhook and teams.'),
pagerduty_routing_key: zod
.string()
.optional()
.describe('Integration key of a PagerDuty Events API v2 integration. Required when type=pagerduty.'),
pagerduty_severity: zod
.enum(['critical', 'error', 'warning', 'info'])
.describe('\* `critical` - critical\n\* `error` - error\n\* `warning` - warning\n\* `info` - info')
.default(logsAlertsDestinationsCreateBodyPagerdutySeverityDefault)
.describe(
'Severity PagerDuty records on the incident. Used when type=pagerduty.\n\n\* `critical` - critical\n\* `error` - error\n\* `warning` - warning\n\* `info` - info'
),
pagerduty_region: zod
.enum(['us', 'eu'])
.describe('\* `us` - us\n\* `eu` - eu')
.default(logsAlertsDestinationsCreateBodyPagerdutyRegionDefault)
.describe('PagerDuty service region of the account. Used when type=pagerduty.\n\n\* `us` - us\n\* `eu` - eu'),
})
/**
* Delete a notification destination by deleting its HogFunction group atomically.
*/
export const LogsAlertsDestinationsDeleteCreateBody = /* @__PURE__ */ zod.object({
hog_function_ids: zod
.array(zod.uuid())
.min(1)
.describe('HogFunction IDs to delete as one atomic destination group.'),
})
/**
* Simulate a logs alert on historical data using the full state machine. Read-only — no alert check records are created.
*/
export const logsAlertsSimulateCreateBodyThresholdCountMin = 0
export const logsAlertsSimulateCreateBodyCheckIntervalMinutesDefault = 5
export const logsAlertsSimulateCreateBodyCheckIntervalMinutesMax = 60
export const logsAlertsSimulateCreateBodyEvaluationPeriodsDefault = 1
export const logsAlertsSimulateCreateBodyEvaluationPeriodsMax = 10
export const logsAlertsSimulateCreateBodyDatapointsToAlarmDefault = 1
export const logsAlertsSimulateCreateBodyDatapointsToAlarmMax = 10
export const logsAlertsSimulateCreateBodyCooldownMinutesDefault = 0
export const logsAlertsSimulateCreateBodyCooldownMinutesMin = 0
export const LogsAlertsSimulateCreateBody = /* @__PURE__ */ zod.object({
filters: zod
.object({
filterGroup: zod
.union([
zod.object({
type: zod.enum(['AND', 'OR']),
values: zod.array(
zod
.record(zod.string(), zod.unknown())
.describe(
'Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)'
)
),
}),
zod.null(),
])
.optional(),
serviceNames: zod.union([zod.array(zod.string()), zod.null()]).optional(),
severityLevels: zod
.union([zod.array(zod.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])), zod.null()])
.optional(),
})
.describe('Filter criteria — same format as LogsAlertConfiguration.filters.'),
threshold_count: zod
.number()
.min(logsAlertsSimulateCreateBodyThresholdCountMin)
.describe('Threshold count to evaluate against.'),
threshold_operator: zod
.enum(['above', 'below'])
.describe('\* `above` - Above\n\* `below` - Below')
.describe(
'Whether the alert fires when the count is above or below the threshold.\n\n\* `above` - Above\n\* `below` - Below'
),
window_minutes: zod.number().describe('Window size in minutes — determines bucket interval.'),
check_interval_minutes: zod
.number()
.min(1)
.max(logsAlertsSimulateCreateBodyCheckIntervalMinutesMax)
.default(logsAlertsSimulateCreateBodyCheckIntervalMinutesDefault)
.describe('How often the alert is evaluated, in minutes.'),
evaluation_periods: zod
.number()
.min(1)
.max(logsAlertsSimulateCreateBodyEvaluationPeriodsMax)
.default(logsAlertsSimulateCreateBodyEvaluationPeriodsDefault)
.describe('Total check periods in the N-of-M evaluation window (M).'),
datapoints_to_alarm: zod
.number()
.min(1)
.max(logsAlertsSimulateCreateBodyDatapointsToAlarmMax)
.default(logsAlertsSimulateCreateBodyDatapointsToAlarmDefault)
.describe('How many periods must breach to fire (N in N-of-M).'),
cooldown_minutes: zod
.number()
.min(logsAlertsSimulateCreateBodyCooldownMinutesMin)
.default(logsAlertsSimulateCreateBodyCooldownMinutesDefault)
.describe(
'Minimum minutes between notifications. A fire or resolve notification inside the cooldown is skipped. 0 means no minimum.'
),
date_from: zod.string().describe("Relative date string for how far back to simulate (e.g. '-24h', '-7d', '-30d')."),
})
/**
* Runs anomaly detection on demand over one service's log volume for the given window. Learns per severity baselines from up to 6 weeks of history and returns per bucket expected bands plus any spike, drop, or silence issues. Synchronous and read only.
* @summary Scan a service's logs for volume anomalies
*/
export const LogsAnomaliesScanCreateBody = /* @__PURE__ */ zod.object({
serviceName: zod
.string()
.describe(
"Service to scan (the log record's service_name). Required: the scan aggregates weeks of baseline history from raw logs, so it is scoped to one service per call."
),
dateRange: zod
.object({
date_from: zod.iso
.datetime({ offset: true })
.describe(
'Start of the evaluation window (ISO 8601). Buckets before this are only used as baseline history.'
),
date_to: zod.iso
.datetime({ offset: true })
.describe('End of the evaluation window (ISO 8601), clamped to now.'),
})
.describe('Evaluation window to scan for anomalies. May span at most 7 days.'),
})
/**
* Returns log volume over the requested window for every (namespace, environment, severity) series of one service, with a time-of-week expected band derived from the prior weeks of the volume rollup. The window defaults to the last 7 days and may span at most 7 days. Synchronous and read only.
* @summary Per-series log volume with expected bands
*/
export const LogsAnomaliesSeriesBandsCreateBody = /* @__PURE__ */ zod.object({
serviceName: zod.string().describe("Service whose per-series volume to chart (the log record's service_name)."),
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the window. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1wStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the window. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe(
'Window to chart. Defaults to the last 7 days. It may span at most 7 days and start at most 35 days ago, past which the volume rollup no longer reaches.'
),
intervalMinutes: zod
.union([
zod
.union([zod.literal(5), zod.literal(15), zod.literal(30), zod.literal(60)])
.describe('\* `5` - 5\n\* `15` - 15\n\* `30` - 30\n\* `60` - 60'),
zod.null(),
])
.optional()
.describe(
"Display grain in minutes for buckets and bands. One of 5, 15, 30, 60. The window may hold at most 500 buckets per series at the chosen grain, so a finer grain needs a shorter window. Omit it to let the window pick its grain, the coarsest that still cuts it into about 168 buckets. A series too sparse to read at this grain is returned at a coarser one; see each series' interval_minutes.\n\n\* `5` - 5\n\* `15` - 15\n\* `30` - 30\n\* `60` - 60"
),
})
export const LogsCountCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Date range for the count. Defaults to last hour.'),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.optional()
.describe('Filter by log severity levels.'),
serviceNames: zod.array(zod.string()).optional().describe('Filter by service names.'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies.'),
filterGroup: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.optional()
.describe('Property filters for the query.'),
})
.describe('The count query to execute.'),
})
export const logsCountRangesCreateBodyQueryOneTargetBucketsDefault = 10
export const logsCountRangesCreateBodyQueryOneTargetBucketsMax = 100
export const LogsCountRangesCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe(
"Window to bucket. Defaults to last hour. Use a bucket's date_from\/date_to from a prior response to recursively narrow into a sub-range."
),
targetBuckets: zod
.number()
.min(1)
.max(logsCountRangesCreateBodyQueryOneTargetBucketsMax)
.default(logsCountRangesCreateBodyQueryOneTargetBucketsDefault)
.describe(
'Approximate number of buckets to return. The bucket interval is picked adaptively from a fixed list (1\/5\/10s, 1\/2\/5\/10\/15\/30\/60\/120\/240\/360\/720\/1440m) to land near this target. Defaults to 10, capped at 100.'
),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.optional()
.describe('Filter by log severity levels. Applied before bucketing.'),
serviceNames: zod
.array(zod.string())
.optional()
.describe('Filter by service names. Applied before bucketing.'),
searchTerm: zod
.string()
.optional()
.describe('Full-text search across log bodies. Applied before bucketing.'),
filterGroup: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.optional()
.describe('Property filters applied before bucketing. Same shape as `query-logs`.'),
})
.describe('The bucketed-count query to execute.'),
})
/**
* Explain a log entry using AI.
*
* POST /api/environments/:id/logs/explainLogWithAI/
*/
export const logsExplainLogWithAICreateBodyForceRefreshDefault = false
export const LogsExplainLogWithAICreateBody = /* @__PURE__ */ zod.object({
uuid: zod.string().describe('UUID of the log entry to explain'),
timestamp: zod.iso.datetime({ offset: true }).describe('Timestamp of the log entry (used for efficient lookup)'),
force_refresh: zod
.boolean()
.default(logsExplainLogWithAICreateBodyForceRefreshDefault)
.describe('Force regenerate explanation, bypassing cache'),
})
export const LogsFacetValuesCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
facetField: zod
.union([
zod
.enum(['severity_text', 'service_name'])
.describe('\* `severity_text` - severity_text\n\* `service_name` - service_name'),
zod.null(),
])
.optional()
.describe(
"Top-level column to facet on. Provide exactly one of facetField, facetResourceAttribute or facetAttribute. Counts come from a rollup with 5-minute buckets, so the window widens to the buckets that contain date_from and date_to. The rollup honours severityLevels and serviceNames, but not body search, log-attribute filters, or resource-attribute filters. When personId or sessionId is set, counts come from the logs table with the exact window and every other filter. Both paths exclude this facet's own filter.\n\n\* `severity_text` - severity_text\n\* `service_name` - service_name"
),
facetResourceAttribute: zod
.string()
.nullish()
.describe(
"Resource attribute key to facet on (e.g. 'k8s.namespace.name'). Provide exactly one of facetField, facetResourceAttribute or facetAttribute. Its own log_resource_attribute filter is excluded so counts reflect the other active filters."
),
facetAttribute: zod
.string()
.nullish()
.describe(
"Log attribute key to facet on (e.g. 'log.iostream'). Provide exactly one of facetField, facetResourceAttribute or facetAttribute. Counts honour severity, service and resource-attribute filters, but not body search, other log-attribute filters, or this facet's own filter."
),
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Date range. Defaults to last hour.'),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.optional()
.describe('Filter by log severity levels (ignored when faceting on severity_text).'),
serviceNames: zod
.array(zod.string())
.optional()
.describe('Filter by service names (ignored when faceting on service_name).'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies.'),
facetSearch: zod
.string()
.optional()
.describe(
"Type-ahead filter over the faceted field's own values (case-insensitive substring match). Distinct from searchTerm, which searches log bodies."
),
filterGroup: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.optional()
.describe('Property filters for the query.'),
personId: zod
.string()
.optional()
.describe(
"Scope counts to one person (UUID or numeric ID). Expanded server-side to the person's distinct IDs and matched against the team's configured distinct-id log attribute keys."
),
sessionId: zod
.string()
.optional()
.describe(
"Scope counts to one session ID. Matched server-side against the team's configured session-id log attribute keys plus the built-in conventions, in both log attributes and resource attributes."
),
})
.describe('The facet values query to execute.'),
})
export const logsGroupByCreateBodyQueryOneGroupBySourceDefault = `log`
export const logsGroupByCreateBodyQueryOneGroupBysItemSourceDefault = `log`
export const logsGroupByCreateBodyQueryOneGroupBysMax = 4
export const logsGroupByCreateBodyQueryOneOrderGroupsByDefault = `log_count`
export const logsGroupByCreateBodyQueryOneLimitDefault = 100
export const logsGroupByCreateBodyQueryOneLimitMax = 500
export const LogsGroupByCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Date range to aggregate over. Defaults to last hour.'),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.optional()
.describe('Filter by log severity levels before grouping.'),
serviceNames: zod.array(zod.string()).optional().describe('Restrict grouping to these service names.'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies before grouping.'),
filterGroup: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.optional()
.describe('Property filters applied before grouping. Same shape as the query-logs endpoint.'),
groupBy: zod
.string()
.optional()
.describe(
'The key to group logs by — an attribute key (e.g. \"session_id\", \"service.name\") or, when groupBySource is \"column\", one of the top-level log fields: \"severity_level\", \"service_name\", \"trace_id\", \"span_id\", \"pattern\". Ignored when groupBys is provided.'
),
groupBySource: zod
.enum(['log', 'resource', 'column'])
.describe('\* `log` - log\n\* `resource` - resource\n\* `column` - column')
.default(logsGroupByCreateBodyQueryOneGroupBySourceDefault)
.describe(
'Where the grouping key lives: \"log\" for log-level attributes, \"resource\" for resource-level attributes, \"column\" for top-level log fields. Ignored when groupBys is provided.\n\n\* `log` - log\n\* `resource` - resource\n\* `column` - column'
),
groupBys: zod
.array(
zod.object({
key: zod
.string()
.describe(
'The key this dimension groups by — an attribute key (e.g. \"session_id\", \"service.name\") or, when source is \"column\", one of the top-level log fields: \"severity_level\", \"service_name\", \"trace_id\", \"span_id\", \"pattern\" (the masked message template).'
),
source: zod
.enum(['log', 'resource', 'column'])
.describe('\* `log` - log\n\* `resource` - resource\n\* `column` - column')
.default(logsGroupByCreateBodyQueryOneGroupBysItemSourceDefault)
.describe(
'Where this dimension\'s key lives: \"log\" for log-level attributes, \"resource\" for resource-level attributes, \"column\" for top-level log fields.\n\n\* `log` - log\n\* `resource` - resource\n\* `column` - column'
),
})
)
.min(1)
.max(logsGroupByCreateBodyQueryOneGroupBysMax)
.optional()
.describe(
'Ordered group-by dimensions to combine (a group is one combination of per-dimension values), up to 4. Takes precedence over groupBy\/groupBySource; one of the two must be provided.'
),
orderGroupsBy: zod
.enum(['log_count', 'error_count', 'last_seen'])
.describe('\* `log_count` - log_count\n\* `error_count` - error_count\n\* `last_seen` - last_seen')
.default(logsGroupByCreateBodyQueryOneOrderGroupsByDefault)
.describe(
'Aggregate to rank groups by (descending): \"log_count\" for the noisiest groups, \"error_count\" for the most failing, \"last_seen\" for the most recent.\n\n\* `log_count` - log_count\n\* `error_count` - error_count\n\* `last_seen` - last_seen'
),
limit: zod
.number()
.min(1)
.max(logsGroupByCreateBodyQueryOneLimitMax)
.default(logsGroupByCreateBodyQueryOneLimitDefault)
.describe('Maximum number of groups to return (top-N by orderGroupsBy). Defaults to 100.'),
personId: zod
.string()
.optional()
.describe(
"Scope grouping to one person (UUID or numeric ID). Expanded server-side to the person's distinct IDs and matched against the team's configured distinct-id log attribute keys."
),
sessionId: zod
.string()
.optional()
.describe(
"Scope grouping to one session ID. Matched server-side against the team's configured session-id log attribute keys plus the built-in conventions, in both log attributes and resource attributes."
),
})
.describe('The group-by query to execute.'),
})
export const LogsImpactCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Date range for the count. Defaults to last hour.'),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.optional()
.describe('Filter by log severity levels.'),
serviceNames: zod.array(zod.string()).optional().describe('Filter by service names.'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies.'),
filterGroup: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.optional()
.describe('Property filters for the query.'),
})
.describe('The impact query to execute. Takes the same filters as the count query.'),
})
export const logsMetricRulesCreateBodyNameMax = 255
export const logsMetricRulesCreateBodyMetricNameMax = 200
export const logsMetricRulesCreateBodyEnabledDefault = false
export const logsMetricRulesCreateBodyValueAttributeMax = 512
export const logsMetricRulesCreateBodyGroupByItemMax = 512
export const logsMetricRulesCreateBodySourceDefault = `logs`
export const LogsMetricRulesCreateBody = /* @__PURE__ */ zod.object({
name: zod.string().max(logsMetricRulesCreateBodyNameMax).describe('User-visible label for this rule.'),
metric_name: zod
.string()
.max(logsMetricRulesCreateBodyMetricNameMax)
.describe(
'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.'
),
enabled: zod
.boolean()
.default(logsMetricRulesCreateBodyEnabledDefault)
.describe(
'When true, ingestion evaluates this rule against every log record. At most 10 rules can be enabled per project.'
),
filter_group: zod
.unknown()
.optional()
.describe(
'PropertyGroupFilter JSON (AND\/OR tree of property predicates) selecting which log records feed the metric, e.g. `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\",\"type\":\"log_attribute\"}]}]}`. Null matches every ingested log record. Every group must contain at least one filter — empty groups never match.'
),
value_attribute: zod
.string()
.max(logsMetricRulesCreateBodyValueAttributeMax)
.nullish()
.describe(
'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.'
),
group_by: zod
.array(zod.string().max(logsMetricRulesCreateBodyGroupByItemMax))
.optional()
.describe(
'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.'
),
source: zod
.enum(['logs', 'spans'])
.describe('\* `logs` - Logs\n\* `spans` - Spans')
.default(logsMetricRulesCreateBodySourceDefault)
.describe(
'Record source the rule tallies: `logs` (default) evaluates in the logs consumer, `spans` in the traces consumer. Immutable after creation — it decides which keys are valid and which pipeline runs the rule.\n\n\* `logs` - Logs\n\* `spans` - Spans'
),
})
export const logsMetricRulesUpdateBodyNameMax = 255
export const logsMetricRulesUpdateBodyMetricNameMax = 200
export const logsMetricRulesUpdateBodyEnabledDefault = false
export const logsMetricRulesUpdateBodyValueAttributeMax = 512
export const logsMetricRulesUpdateBodyGroupByItemMax = 512
export const logsMetricRulesUpdateBodySourceDefault = `logs`
export const LogsMetricRulesUpdateBody = /* @__PURE__ */ zod.object({
name: zod.string().max(logsMetricRulesUpdateBodyNameMax).describe('User-visible label for this rule.'),
metric_name: zod
.string()
.max(logsMetricRulesUpdateBodyMetricNameMax)
.describe(
'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.'
),
enabled: zod
.boolean()
.default(logsMetricRulesUpdateBodyEnabledDefault)
.describe(
'When true, ingestion evaluates this rule against every log record. At most 10 rules can be enabled per project.'
),
filter_group: zod
.unknown()
.optional()
.describe(
'PropertyGroupFilter JSON (AND\/OR tree of property predicates) selecting which log records feed the metric, e.g. `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\",\"type\":\"log_attribute\"}]}]}`. Null matches every ingested log record. Every group must contain at least one filter — empty groups never match.'
),
value_attribute: zod
.string()
.max(logsMetricRulesUpdateBodyValueAttributeMax)
.nullish()
.describe(
'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.'
),
group_by: zod
.array(zod.string().max(logsMetricRulesUpdateBodyGroupByItemMax))
.optional()
.describe(
'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.'
),
source: zod
.enum(['logs', 'spans'])
.describe('\* `logs` - Logs\n\* `spans` - Spans')
.default(logsMetricRulesUpdateBodySourceDefault)
.describe(
'Record source the rule tallies: `logs` (default) evaluates in the logs consumer, `spans` in the traces consumer. Immutable after creation — it decides which keys are valid and which pipeline runs the rule.\n\n\* `logs` - Logs\n\* `spans` - Spans'
),
})
export const logsMetricRulesPartialUpdateBodyNameMax = 255
export const logsMetricRulesPartialUpdateBodyMetricNameMax = 200
export const logsMetricRulesPartialUpdateBodyEnabledDefault = false
export const logsMetricRulesPartialUpdateBodyValueAttributeMax = 512
export const logsMetricRulesPartialUpdateBodyGroupByItemMax = 512
export const logsMetricRulesPartialUpdateBodySourceDefault = `logs`
export const LogsMetricRulesPartialUpdateBody = /* @__PURE__ */ zod.object({
name: zod
.string()
.max(logsMetricRulesPartialUpdateBodyNameMax)
.optional()
.describe('User-visible label for this rule.'),
metric_name: zod
.string()
.max(logsMetricRulesPartialUpdateBodyMetricNameMax)
.optional()
.describe(
'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.'
),
enabled: zod
.boolean()
.default(logsMetricRulesPartialUpdateBodyEnabledDefault)
.describe(
'When true, ingestion evaluates this rule against every log record. At most 10 rules can be enabled per project.'
),
filter_group: zod
.unknown()
.optional()
.describe(
'PropertyGroupFilter JSON (AND\/OR tree of property predicates) selecting which log records feed the metric, e.g. `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\",\"type\":\"log_attribute\"}]}]}`. Null matches every ingested log record. Every group must contain at least one filter — empty groups never match.'
),
value_attribute: zod
.string()
.max(logsMetricRulesPartialUpdateBodyValueAttributeMax)
.nullish()
.describe(
'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.'
),
group_by: zod
.array(zod.string().max(logsMetricRulesPartialUpdateBodyGroupByItemMax))
.optional()
.describe(
'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.'
),
source: zod
.enum(['logs', 'spans'])
.describe('\* `logs` - Logs\n\* `spans` - Spans')
.default(logsMetricRulesPartialUpdateBodySourceDefault)
.describe(
'Record source the rule tallies: `logs` (default) evaluates in the logs consumer, `spans` in the traces consumer. Immutable after creation — it decides which keys are valid and which pipeline runs the rule.\n\n\* `logs` - Logs\n\* `spans` - Spans'
),
})
/**
* Turn a plain-language request into ranked log viewer filter candidates. Nothing is persisted. Only the request text, service names and attribute keys are sent to the models.
*/
export const logsNaturalLanguageQueryCreateBodyQueryMax = 500
export const LogsNaturalLanguageQueryCreateBody = /* @__PURE__ */ zod.object({
query: zod
.string()
.max(logsNaturalLanguageQueryCreateBodyQueryMax)
.describe("The plain-language request, for example 'error logs from checkout in the last 2 hours'."),
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats such as -1h or -7d.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Null means \"now\".'),
})
.optional()
.describe(
"The viewer's current date range. Used when the request names no time, and to scope the service and attribute lists the model may choose from."
),
})
export const LogsPatternsCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Date range to mine patterns from. Defaults to last hour.'),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.optional()
.describe('Filter by log severity levels before mining.'),
serviceNames: zod.array(zod.string()).optional().describe('Restrict mining to these service names.'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies before mining.'),
filterGroup: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.optional()
.describe('Property filters applied before mining. Same shape as the query-logs endpoint.'),
personId: zod
.string()
.optional()
.describe(
"Scope mining to one person (UUID or numeric ID). Expanded server-side to the person's distinct IDs and matched against the team's configured distinct-id log attribute keys."
),
sessionId: zod
.string()
.optional()
.describe(
"Scope mining to one session ID. Matched server-side against the team's configured session-id log attribute keys plus the built-in conventions, in both log attributes and resource attributes."
),
})
.describe('The patterns query to execute.'),
})
export const logsPatternsDiffCreateBodyQueryOneLimitMax = 500
export const LogsPatternsDiffCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Date range to mine patterns from. Defaults to last hour.'),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.optional()
.describe('Filter by log severity levels before mining.'),
serviceNames: zod.array(zod.string()).optional().describe('Restrict mining to these service names.'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies before mining.'),
filterGroup: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.optional()
.describe('Property filters applied before mining. Same shape as the query-logs endpoint.'),
personId: zod
.string()
.optional()
.describe(
"Scope mining to one person (UUID or numeric ID). Expanded server-side to the person's distinct IDs and matched against the team's configured distinct-id log attribute keys."
),
sessionId: zod
.string()
.optional()
.describe(
"Scope mining to one session ID. Matched server-side against the team's configured session-id log attribute keys plus the built-in conventions, in both log attributes and resource attributes."
),
limit: zod
.number()
.min(1)
.max(logsPatternsDiffCreateBodyQueryOneLimitMax)
.nullish()
.describe('Return at most this many entries, most interesting first. Omit for all. Sets `truncated`.'),
})
.describe(
'The patterns query for the current (foreground) window: date range plus any severity\/service\/search\/property filters. The same filters are applied to the baseline window.'
),
baselineDateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe(
'Baseline window to compare against. Omit to default to the current window shifted back exactly one week, which absorbs daily and weekly log-volume cycles. Pass an explicit range to compare against a specific period, e.g. pre-deploy or pre-incident.'
),
})
export const logsQueryCreateBodyQueryOneSeverityLevelsDefault = []
export const logsQueryCreateBodyQueryOneServiceNamesDefault = []
export const logsQueryCreateBodyQueryOneLimitDefault = 100
export const logsQueryCreateBodyQueryOneExcludeAttributesDefault = false
export const logsQueryCreateBodyQueryOneCustomColumnsDefault = []
export const LogsQueryCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Date range for the query. Defaults to last hour.'),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.default(logsQueryCreateBodyQueryOneSeverityLevelsDefault)
.describe('Filter by log severity levels.'),
serviceNames: zod
.array(zod.string())
.default(logsQueryCreateBodyQueryOneServiceNamesDefault)
.describe('Filter by service names.'),
orderBy: zod
.enum(['latest', 'earliest'])
.describe('\* `latest` - latest\n\* `earliest` - earliest')
.optional()
.describe('Order results by timestamp.\n\n\* `latest` - latest\n\* `earliest` - earliest'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies.'),
filterGroup: zod
.union([
zod.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
),
zod.object({
type: zod
.enum(['AND', 'OR'])
.describe('How to combine the groups in `values`.\n\n\* `AND` - AND\n\* `OR` - OR'),
values: zod
.array(
zod.object({
type: zod
.enum(['AND', 'OR'])
.describe(
'How to combine the filters in `values`.\n\n\* `AND` - AND\n\* `OR` - OR'
),
values: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.describe('Property filters in this group.'),
})
)
.describe('Groups of property filters.'),
}),
])
.optional()
.describe(
'Property filters for the query. Pass a list of filters, which are all combined with AND, or a filter group object with nested AND\/OR groups.'
),
limit: zod
.number()
.min(1)
.default(logsQueryCreateBodyQueryOneLimitDefault)
.describe('Max results. Values above 2000 are capped at 2000.'),
after: zod.string().optional().describe('Pagination cursor from previous response.'),
excludeAttributes: zod
.boolean()
.default(logsQueryCreateBodyQueryOneExcludeAttributesDefault)
.describe(
'Omit the per-log attributes and resource_attributes maps from results to keep payloads compact. Defaults to false.'
),
customColumns: zod
.array(zod.string())
.default(logsQueryCreateBodyQueryOneCustomColumnsDefault)
.describe(
"Custom column expressions evaluated per log row. Each entry is either a source-prefixed shorthand (`attributes.<key>`, `resource_attributes.<key>`, `body.<json.path>`) or a scalar HogQL expression (`upper(level)`, `coalesce(attributes['a'], attributes['b'])`). Aggregations and subqueries are rejected. Values come back on each result row keyed by the aliases echoed in the response `columns` field."
),
personId: zod
.string()
.optional()
.describe(
"Scope results to one person (UUID or numeric ID). Expanded server-side to the person's distinct IDs and matched against the team's configured distinct-id log attribute keys."
),
sessionId: zod
.string()
.optional()
.describe(
"Scope results to one session ID. Matched server-side against the team's configured session-id log attribute keys plus the built-in conventions, in both log attributes and resource attributes."
),
})
.describe('The logs query to execute.'),
})
/**
* Retention rules for one record kind.
*
* `TracingRetentionRuleViewSet` reuses this for span rules, which live in their own model. It
* swaps the queryset, the serializer and `team_rules`, so every read and write here goes through
* `team_rules` rather than naming a model.
*/
export const logsRetentionRulesCreateBodyNameMax = 255
export const logsRetentionRulesCreateBodyEnabledDefault = false
export const logsRetentionRulesCreateBodyPriorityMin = 0
export const LogsRetentionRulesCreateBody = /* @__PURE__ */ zod.object({
name: zod.string().max(logsRetentionRulesCreateBodyNameMax).describe('User-visible label for this rule.'),
enabled: zod
.boolean()
.default(logsRetentionRulesCreateBodyEnabledDefault)
.describe('When false, the rule is ignored by ingestion and listing UIs that show active rules only.'),
priority: zod
.number()
.min(logsRetentionRulesCreateBodyPriorityMin)
.nullish()
.describe(
'Lower numbers are evaluated first; the first matching rule wins. Omit to append after existing rules.'
),
config: zod
.unknown()
.describe(
'Retention rule JSON. Required keys: `retention_days` (integer — how long matching logs are kept; must be a tier the organization is entitled to, same as the team-wide Logs retention setting) and `filter_group` (PropertyGroupFilter shape — an AND\/OR tree of property predicates evaluated per record to decide which logs this rule matches). Example: `{\"retention_days\":30,\"filter_group\":{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}}`. Logs matching no enabled rule keep the environment\'s default retention.'
),
})
/**
* Retention rules for one record kind.
*
* `TracingRetentionRuleViewSet` reuses this for span rules, which live in their own model. It
* swaps the queryset, the serializer and `team_rules`, so every read and write here goes through
* `team_rules` rather than naming a model.
*/
export const logsRetentionRulesUpdateBodyNameMax = 255
export const logsRetentionRulesUpdateBodyEnabledDefault = false
export const logsRetentionRulesUpdateBodyPriorityMin = 0
export const LogsRetentionRulesUpdateBody = /* @__PURE__ */ zod.object({
name: zod.string().max(logsRetentionRulesUpdateBodyNameMax).describe('User-visible label for this rule.'),
enabled: zod
.boolean()
.default(logsRetentionRulesUpdateBodyEnabledDefault)
.describe('When false, the rule is ignored by ingestion and listing UIs that show active rules only.'),
priority: zod
.number()
.min(logsRetentionRulesUpdateBodyPriorityMin)
.nullish()
.describe(
'Lower numbers are evaluated first; the first matching rule wins. Omit to append after existing rules.'
),
config: zod
.unknown()
.describe(
'Retention rule JSON. Required keys: `retention_days` (integer — how long matching logs are kept; must be a tier the organization is entitled to, same as the team-wide Logs retention setting) and `filter_group` (PropertyGroupFilter shape — an AND\/OR tree of property predicates evaluated per record to decide which logs this rule matches). Example: `{\"retention_days\":30,\"filter_group\":{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}}`. Logs matching no enabled rule keep the environment\'s default retention.'
),
})
/**
* Retention rules for one record kind.
*
* `TracingRetentionRuleViewSet` reuses this for span rules, which live in their own model. It
* swaps the queryset, the serializer and `team_rules`, so every read and write here goes through
* `team_rules` rather than naming a model.
*/
export const logsRetentionRulesPartialUpdateBodyNameMax = 255
export const logsRetentionRulesPartialUpdateBodyEnabledDefault = false
export const logsRetentionRulesPartialUpdateBodyPriorityMin = 0
export const LogsRetentionRulesPartialUpdateBody = /* @__PURE__ */ zod.object({
name: zod
.string()
.max(logsRetentionRulesPartialUpdateBodyNameMax)
.optional()
.describe('User-visible label for this rule.'),
enabled: zod
.boolean()
.default(logsRetentionRulesPartialUpdateBodyEnabledDefault)
.describe('When false, the rule is ignored by ingestion and listing UIs that show active rules only.'),
priority: zod
.number()
.min(logsRetentionRulesPartialUpdateBodyPriorityMin)
.nullish()
.describe(
'Lower numbers are evaluated first; the first matching rule wins. Omit to append after existing rules.'
),
config: zod
.unknown()
.optional()
.describe(
'Retention rule JSON. Required keys: `retention_days` (integer — how long matching logs are kept; must be a tier the organization is entitled to, same as the team-wide Logs retention setting) and `filter_group` (PropertyGroupFilter shape — an AND\/OR tree of property predicates evaluated per record to decide which logs this rule matches). Example: `{\"retention_days\":30,\"filter_group\":{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}}`. Logs matching no enabled rule keep the environment\'s default retention.'
),
})
/**
* Atomically reassign priorities so the given ID order maps to ascending priorities (0..n-1).
*/
export const LogsRetentionRulesReorderCreateBody = /* @__PURE__ */ zod.object({
ordered_ids: zod
.array(zod.uuid())
.describe(
'Rule IDs in the desired evaluation order (first element is highest priority \/ lowest order index).'
),
})
/**
* Suggest a human-readable name for a retention rule from its retention tier and filter group. Used by the create form as an auto-suggest; nothing is persisted. Returns an empty name when a suggestion can't be generated.
*/
export const LogsRetentionRulesSuggestNameCreateBody = /* @__PURE__ */ zod.object({
retention_days: zod.number().describe('Retention tier the rule would assign, in days.'),
filter_group: zod.unknown().describe('PropertyGroupFilter tree the rule would match on.'),
})
export const logsSamplingRulesCreateBodyNameMax = 255
export const logsSamplingRulesCreateBodyEnabledDefault = false
export const logsSamplingRulesCreateBodyPriorityMin = 0
export const logsSamplingRulesCreateBodyScopeServiceMax = 512
export const logsSamplingRulesCreateBodyScopePathPatternMax = 1024
export const LogsSamplingRulesCreateBody = /* @__PURE__ */ zod.object({
name: zod.string().max(logsSamplingRulesCreateBodyNameMax).describe('User-visible label for this rule.'),
enabled: zod
.boolean()
.default(logsSamplingRulesCreateBodyEnabledDefault)
.describe('When false, the rule is ignored by ingestion and listing UIs that show active rules only.'),
priority: zod
.number()
.min(logsSamplingRulesCreateBodyPriorityMin)
.nullish()
.describe(
'Lower numbers are evaluated first; the first matching rule wins. Omit to append after existing rules.'
),
rule_type: zod
.enum(['severity_sampling', 'path_drop', 'rate_limit'])
.describe(
'\* `severity_sampling` - Severity-based reduction\n\* `path_drop` - Path exclusion\n\* `rate_limit` - Rate limit'
)
.describe(
'Rule kind: severity_sampling, path_drop, or rate_limit (caps matching log volume at ingestion).\n\n\* `severity_sampling` - Severity-based reduction\n\* `path_drop` - Path exclusion\n\* `rate_limit` - Rate limit'
),
scope_service: zod
.string()
.max(logsSamplingRulesCreateBodyScopeServiceMax)
.nullish()
.describe('Optional legacy service-name scope; new rules use `config.filter_group` for matching instead.'),
scope_path_pattern: zod
.string()
.max(logsSamplingRulesCreateBodyScopePathPatternMax)
.nullish()
.describe('Optional regex matched against a path-like log attribute when present.'),
scope_attribute_filters: zod
.array(zod.record(zod.string(), zod.unknown()))
.optional()
.describe(
'Optional list of predicates over string attributes, e.g. [{\"key\":\"http.route\",\"op\":\"eq\",\"value\":\"\/api\"}].'
),
config: zod
.unknown()
.describe(
'Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND\/OR tree of property predicates evaluated per record) and\/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}`. Every group in `filter_group` must contain at least one filter — empty groups never match, so the rule would never apply. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB\/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes.'
),
})
export const logsSamplingRulesUpdateBodyNameMax = 255
export const logsSamplingRulesUpdateBodyEnabledDefault = false
export const logsSamplingRulesUpdateBodyPriorityMin = 0
export const logsSamplingRulesUpdateBodyScopeServiceMax = 512
export const logsSamplingRulesUpdateBodyScopePathPatternMax = 1024
export const LogsSamplingRulesUpdateBody = /* @__PURE__ */ zod.object({
name: zod.string().max(logsSamplingRulesUpdateBodyNameMax).describe('User-visible label for this rule.'),
enabled: zod
.boolean()
.default(logsSamplingRulesUpdateBodyEnabledDefault)
.describe('When false, the rule is ignored by ingestion and listing UIs that show active rules only.'),
priority: zod
.number()
.min(logsSamplingRulesUpdateBodyPriorityMin)
.nullish()
.describe(
'Lower numbers are evaluated first; the first matching rule wins. Omit to append after existing rules.'
),
rule_type: zod
.enum(['severity_sampling', 'path_drop', 'rate_limit'])
.describe(
'\* `severity_sampling` - Severity-based reduction\n\* `path_drop` - Path exclusion\n\* `rate_limit` - Rate limit'
)
.describe(
'Rule kind: severity_sampling, path_drop, or rate_limit (caps matching log volume at ingestion).\n\n\* `severity_sampling` - Severity-based reduction\n\* `path_drop` - Path exclusion\n\* `rate_limit` - Rate limit'
),
scope_service: zod
.string()
.max(logsSamplingRulesUpdateBodyScopeServiceMax)
.nullish()
.describe('Optional legacy service-name scope; new rules use `config.filter_group` for matching instead.'),
scope_path_pattern: zod
.string()
.max(logsSamplingRulesUpdateBodyScopePathPatternMax)
.nullish()
.describe('Optional regex matched against a path-like log attribute when present.'),
scope_attribute_filters: zod
.array(zod.record(zod.string(), zod.unknown()))
.optional()
.describe(
'Optional list of predicates over string attributes, e.g. [{\"key\":\"http.route\",\"op\":\"eq\",\"value\":\"\/api\"}].'
),
config: zod
.unknown()
.describe(
'Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND\/OR tree of property predicates evaluated per record) and\/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}`. Every group in `filter_group` must contain at least one filter — empty groups never match, so the rule would never apply. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB\/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes.'
),
})
export const logsSamplingRulesPartialUpdateBodyNameMax = 255
export const logsSamplingRulesPartialUpdateBodyEnabledDefault = false
export const logsSamplingRulesPartialUpdateBodyPriorityMin = 0
export const logsSamplingRulesPartialUpdateBodyScopeServiceMax = 512
export const logsSamplingRulesPartialUpdateBodyScopePathPatternMax = 1024
export const LogsSamplingRulesPartialUpdateBody = /* @__PURE__ */ zod.object({
name: zod
.string()
.max(logsSamplingRulesPartialUpdateBodyNameMax)
.optional()
.describe('User-visible label for this rule.'),
enabled: zod
.boolean()
.default(logsSamplingRulesPartialUpdateBodyEnabledDefault)
.describe('When false, the rule is ignored by ingestion and listing UIs that show active rules only.'),
priority: zod
.number()
.min(logsSamplingRulesPartialUpdateBodyPriorityMin)
.nullish()
.describe(
'Lower numbers are evaluated first; the first matching rule wins. Omit to append after existing rules.'
),
rule_type: zod
.enum(['severity_sampling', 'path_drop', 'rate_limit'])
.describe(
'\* `severity_sampling` - Severity-based reduction\n\* `path_drop` - Path exclusion\n\* `rate_limit` - Rate limit'
)
.optional()
.describe(
'Rule kind: severity_sampling, path_drop, or rate_limit (caps matching log volume at ingestion).\n\n\* `severity_sampling` - Severity-based reduction\n\* `path_drop` - Path exclusion\n\* `rate_limit` - Rate limit'
),
scope_service: zod
.string()
.max(logsSamplingRulesPartialUpdateBodyScopeServiceMax)
.nullish()
.describe('Optional legacy service-name scope; new rules use `config.filter_group` for matching instead.'),
scope_path_pattern: zod
.string()
.max(logsSamplingRulesPartialUpdateBodyScopePathPatternMax)
.nullish()
.describe('Optional regex matched against a path-like log attribute when present.'),
scope_attribute_filters: zod
.array(zod.record(zod.string(), zod.unknown()))
.optional()
.describe(
'Optional list of predicates over string attributes, e.g. [{\"key\":\"http.route\",\"op\":\"eq\",\"value\":\"\/api\"}].'
),
config: zod
.unknown()
.optional()
.describe(
'Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND\/OR tree of property predicates evaluated per record) and\/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}`. Every group in `filter_group` must contain at least one filter — empty groups never match, so the rule would never apply. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB\/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes.'
),
})
/**
* Atomically reassign priorities so the given ID order maps to ascending priorities (0..n-1).
*/
export const LogsSamplingRulesReorderCreateBody = /* @__PURE__ */ zod.object({
ordered_ids: zod
.array(zod.uuid())
.describe(
'Rule IDs in the desired evaluation order (first element is highest priority \/ lowest order index).'
),
})
export const logsServicesCreateBodyQueryOneServiceNameSearchMax = 200
export const logsServicesCreateBodyQueryOneEnvironmentMax = 200
export const logsServicesCreateBodyQueryOneCompareDefault = `none`
export const LogsServicesCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Date range for the services aggregation. Defaults to last hour.'),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.optional()
.describe('Filter by log severity levels.'),
serviceNames: zod
.array(zod.string())
.optional()
.describe('Restrict the aggregation to these service names.'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies.'),
serviceNameSearch: zod
.string()
.max(logsServicesCreateBodyQueryOneServiceNameSearchMax)
.optional()
.describe(
'Case-insensitive substring match on service name, applied before aggregation. Use to reach services beyond the response cap.'
),
filterGroup: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.optional()
.describe('Property filters for the query.'),
environment: zod
.string()
.max(logsServicesCreateBodyQueryOneEnvironmentMax)
.optional()
.describe(
'Deployment environment, matched without case against the first set resource attribute of deployment.environment.name, deployment.environment and env. \"(none)\" matches logs without one.'
),
compare: zod
.enum(['none', 'previous_period', 'previous_day', 'previous_week'])
.describe(
'\* `none` - No baseline\n\* `previous_period` - Previous period\n\* `previous_day` - Same window a day earlier\n\* `previous_week` - Same window a week earlier'
)
.default(logsServicesCreateBodyQueryOneCompareDefault)
.describe(
'Baseline window for per-service status: the window just before, the same window a day or a week earlier, or none. Silent services (logs in the baseline, none now) only appear with a baseline.\n\n\* `none` - No baseline\n\* `previous_period` - Previous period\n\* `previous_day` - Same window a day earlier\n\* `previous_week` - Same window a week earlier'
),
})
.describe('The services aggregation query to execute.'),
baselineDateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Explicit baseline window. Takes precedence over `query.compare`.'),
})
export const logsSparklineCreateBodyQueryOneSeverityLevelsDefault = []
export const logsSparklineCreateBodyQueryOneServiceNamesDefault = []
export const LogsSparklineCreateBody = /* @__PURE__ */ zod.object({
query: zod
.object({
dateRange: zod
.object({
date_from: zod
.string()
.nullish()
.describe(
'Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc.'
),
date_to: zod
.string()
.nullish()
.describe('End of the date range. Same format as date_from. Omit or null for \"now\".'),
})
.optional()
.describe('Date range for the sparkline. Defaults to last hour.'),
severityLevels: zod
.array(
zod
.enum(['trace', 'debug', 'info', 'warn', 'error', 'fatal'])
.describe(
'\* `trace` - trace\n\* `debug` - debug\n\* `info` - info\n\* `warn` - warn\n\* `error` - error\n\* `fatal` - fatal'
)
)
.default(logsSparklineCreateBodyQueryOneSeverityLevelsDefault)
.describe('Filter by log severity levels.'),
serviceNames: zod
.array(zod.string())
.default(logsSparklineCreateBodyQueryOneServiceNamesDefault)
.describe('Filter by service names.'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies.'),
filterGroup: zod
.union([
zod.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
),
zod.object({
type: zod
.enum(['AND', 'OR'])
.describe('How to combine the groups in `values`.\n\n\* `AND` - AND\n\* `OR` - OR'),
values: zod
.array(
zod.object({
type: zod
.enum(['AND', 'OR'])
.describe(
'How to combine the filters in `values`.\n\n\* `AND` - AND\n\* `OR` - OR'
),
values: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"\/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").'
),
type: zod
.enum(['log', 'log_attribute', 'log_resource_attribute'])
.describe(
'\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
)
.describe(
'\"log\" filters the log body\/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n\* `log` - log\n\* `log_attribute` - log_attribute\n\* `log_resource_attribute` - log_resource_attribute'
),
operator: zod
.enum([
'exact',
'is_not',
'icontains',
'not_icontains',
'starts_with',
'not_starts_with',
'ends_with',
'not_ends_with',
'regex',
'not_regex',
'gt',
'lt',
'is_date_exact',
'is_date_before',
'is_date_after',
'is_set',
'is_not_set',
])
.describe(
'\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
)
.describe(
'Comparison operator.\n\n\* `exact` - exact\n\* `is_not` - is_not\n\* `icontains` - icontains\n\* `not_icontains` - not_icontains\n\* `starts_with` - starts_with\n\* `not_starts_with` - not_starts_with\n\* `ends_with` - ends_with\n\* `not_ends_with` - not_ends_with\n\* `regex` - regex\n\* `not_regex` - not_regex\n\* `gt` - gt\n\* `lt` - lt\n\* `is_date_exact` - is_date_exact\n\* `is_date_before` - is_date_before\n\* `is_date_after` - is_date_after\n\* `is_set` - is_set\n\* `is_not_set` - is_not_set'
),
value: zod
.unknown()
.optional()
.describe(
'Value to compare against. String, number, or array of strings. Omit for is_set\/is_not_set operators.'
),
})
)
.describe('Property filters in this group.'),
})
)
.describe('Groups of property filters.'),
}),
])
.optional()
.describe(
'Property filters for the query. Pass a list of filters, which are all combined with AND, or a filter group object with nested AND\/OR groups.'
),
sparklineBreakdownBy: zod
.enum(['severity', 'service'])
.describe('\* `severity` - severity\n\* `service` - service')
.optional()
.describe(
'Break down sparkline by \"severity\" (default) or \"service\".\n\n\* `severity` - severity\n\* `service` - service'
),
sparklineRankBy: zod
.enum(['count', 'bytes'])
.describe('\* `count` - count\n\* `bytes` - bytes')
.optional()
.describe(
'Rank breakdown values by \"count\" (default) or \"bytes\" before collapsing the tail into \"other\".\n\n\* `count` - count\n\* `bytes` - bytes'
),
personId: zod
.string()
.optional()
.describe(
"Scope results to one person (UUID or numeric ID). Expanded server-side to the person's distinct IDs and matched against the team's configured distinct-id log attribute keys."
),
sessionId: zod
.string()
.optional()
.describe(
"Scope results to one session ID. Matched server-side against the team's configured session-id log attribute keys plus the built-in conventions, in both log attributes and resource attributes."
),
})
.describe('The sparkline query to execute.'),
})
export const logsViewsCreateBodyNameMax = 400
export const logsViewsCreateBodyColumnsItemWidthMax = 2000
export const LogsViewsCreateBody = /* @__PURE__ */ zod.object({
name: zod.string().max(logsViewsCreateBodyNameMax),
filters: zod
.record(zod.string(), zod.unknown())
.optional()
.describe(
'Filter criteria — subset of LogsViewerFilters. May contain severityLevels, serviceNames, searchTerm, filterGroup, dateRange, and other keys.'
),
columns: zod
.array(
zod.object({
id: zod
.string()
.describe(
'Client-generated stable identity for list operations (React keys, reorder). Never interpreted by the server.'
),
type: zod
.enum([
'timestamp',
'level',
'source',
'trace_id',
'span_id',
'person',
'session',
'pattern',
'message',
'custom',
])
.describe(
'\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\n\* `person` - person\n\* `session` - session\n\* `pattern` - pattern\n\* `message` - message\n\* `custom` - custom'
)
.describe(
'Column type. Most built-in types resolve client-side from log row fields; `pattern` and `custom` columns are computed server-side, the latter from `expression`.\n\n\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\n\* `person` - person\n\* `session` - session\n\* `pattern` - pattern\n\* `message` - message\n\* `custom` - custom'
),
name: zod
.string()
.optional()
.describe(
"Header label override. Defaults to the built-in type's label, or to the expression for custom columns."
),
expression: zod
.string()
.optional()
.describe(
"Only meaningful for `type: custom`: a source-prefixed shorthand (`attributes.<key>`, `resource_attributes.<key>`, `body.<json.path>`) or a scalar HogQL expression, sent verbatim in the logs query's `customColumns`."
),
width: zod
.number()
.min(1)
.max(logsViewsCreateBodyColumnsItemWidthMax)
.optional()
.describe(
'Column width in pixels (1–2000). Omitted for the default width; ignored for the flex message column.'
),
})
)
.nullish()
.describe(
'Ordered column configuration for the logs table (LogsColumnConfig[]). Order is array index. Null means the view has no column preference and the client renders its default column set. Omitting the field on update leaves the saved configuration unchanged; send null to clear it.'
),
pinned: zod.boolean().optional(),
})
export const logsViewsUpdateBodyNameMax = 400
export const logsViewsUpdateBodyColumnsItemWidthMax = 2000
export const LogsViewsUpdateBody = /* @__PURE__ */ zod.object({
name: zod.string().max(logsViewsUpdateBodyNameMax),
filters: zod
.record(zod.string(), zod.unknown())
.optional()
.describe(
'Filter criteria — subset of LogsViewerFilters. May contain severityLevels, serviceNames, searchTerm, filterGroup, dateRange, and other keys.'
),
columns: zod
.array(
zod.object({
id: zod
.string()
.describe(
'Client-generated stable identity for list operations (React keys, reorder). Never interpreted by the server.'
),
type: zod
.enum([
'timestamp',
'level',
'source',
'trace_id',
'span_id',
'person',
'session',
'pattern',
'message',
'custom',
])
.describe(
'\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\n\* `person` - person\n\* `session` - session\n\* `pattern` - pattern\n\* `message` - message\n\* `custom` - custom'
)
.describe(
'Column type. Most built-in types resolve client-side from log row fields; `pattern` and `custom` columns are computed server-side, the latter from `expression`.\n\n\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\n\* `person` - person\n\* `session` - session\n\* `pattern` - pattern\n\* `message` - message\n\* `custom` - custom'
),
name: zod
.string()
.optional()
.describe(
"Header label override. Defaults to the built-in type's label, or to the expression for custom columns."
),
expression: zod
.string()
.optional()
.describe(
"Only meaningful for `type: custom`: a source-prefixed shorthand (`attributes.<key>`, `resource_attributes.<key>`, `body.<json.path>`) or a scalar HogQL expression, sent verbatim in the logs query's `customColumns`."
),
width: zod
.number()
.min(1)
.max(logsViewsUpdateBodyColumnsItemWidthMax)
.optional()
.describe(
'Column width in pixels (1–2000). Omitted for the default width; ignored for the flex message column.'
),
})
)
.nullish()
.describe(
'Ordered column configuration for the logs table (LogsColumnConfig[]). Order is array index. Null means the view has no column preference and the client renders its default column set. Omitting the field on update leaves the saved configuration unchanged; send null to clear it.'
),
pinned: zod.boolean().optional(),
})
export const logsViewsPartialUpdateBodyNameMax = 400
export const logsViewsPartialUpdateBodyColumnsItemWidthMax = 2000
export const LogsViewsPartialUpdateBody = /* @__PURE__ */ zod.object({
name: zod.string().max(logsViewsPartialUpdateBodyNameMax).optional(),
filters: zod
.record(zod.string(), zod.unknown())
.optional()
.describe(
'Filter criteria — subset of LogsViewerFilters. May contain severityLevels, serviceNames, searchTerm, filterGroup, dateRange, and other keys.'
),
columns: zod
.array(
zod.object({
id: zod
.string()
.describe(
'Client-generated stable identity for list operations (React keys, reorder). Never interpreted by the server.'
),
type: zod
.enum([
'timestamp',
'level',
'source',
'trace_id',
'span_id',
'person',
'session',
'pattern',
'message',
'custom',
])
.describe(
'\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\n\* `person` - person\n\* `session` - session\n\* `pattern` - pattern\n\* `message` - message\n\* `custom` - custom'
)
.describe(
'Column type. Most built-in types resolve client-side from log row fields; `pattern` and `custom` columns are computed server-side, the latter from `expression`.\n\n\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\n\* `person` - person\n\* `session` - session\n\* `pattern` - pattern\n\* `message` - message\n\* `custom` - custom'
),
name: zod
.string()
.optional()
.describe(
"Header label override. Defaults to the built-in type's label, or to the expression for custom columns."
),
expression: zod
.string()
.optional()
.describe(
"Only meaningful for `type: custom`: a source-prefixed shorthand (`attributes.<key>`, `resource_attributes.<key>`, `body.<json.path>`) or a scalar HogQL expression, sent verbatim in the logs query's `customColumns`."
),
width: zod
.number()
.min(1)
.max(logsViewsPartialUpdateBodyColumnsItemWidthMax)
.optional()
.describe(
'Column width in pixels (1–2000). Omitted for the default width; ignored for the flex message column.'
),
})
)
.nullish()
.describe(
'Ordered column configuration for the logs table (LogsColumnConfig[]). Order is array index. Null means the view has no column preference and the client renders its default column set. Omitting the field on update leaves the saved configuration unchanged; send null to clear it.'
),
pinned: zod.boolean().optional(),
})