Files
zooqueen 252e1cb076 Generated clients call the API where it is mounted
`insights/mount.py` is explicit: `/v1/` is the mount and `/api/` is the older
spelling, kept on the wire for released CLI builds and personal-API-key
holders and rewritten once at the edge by `ApiRewriteMiddleware`. Our own
frontend was still on the older spelling: the orval clients were generated
two days before the mount moved and the move did not regenerate them, so 70
files and 2323 paths said `/api/`.

That is not only a spelling. `prepareUrl` in `lib/api.ts` rewrites `/v1/*` to
the selected region's host in OAuth mode and nothing else, because that is
what the cloud CORS allowlist covers — so every generated call quietly stayed
same-origin, and `getExportsContentRetrieveUrl` builds an `<img src>` that
never reaches `lib/api.ts` at all.

The clients are regenerated from a spec that needs postgres, the datastore and
Django, so this is the path strings only, which is the whole of what the mount
move changes in them: orval copies paths verbatim from the spec, and the spec
takes them from the URLconf. Doc comments carried the same stale prefix and
move with them; their Python docstrings already say `/v1/`. The two frozen
OAuth client-metadata paths are identifiers rather than API surface and appear
in none of these files.

The Slack task prompt told the agent to POST to
`$INSIGHTS_API_URL/api/projects/...`, which is a live request path, not prose.
2026-08-24 23:13:08 -07:00

1966 lines
108 KiB
TypeScript
Generated
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Auto-generated Zod validation schemas from the Django backend OpenAPI schema.
* To modify these schemas, update the Django serializers or views, then run:
* insightscli build:openapi
* Questions or issues? #team-devex on Slack
*
* Insights API - generated
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
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 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 repeated notifications after the alert fires. 0 means no cooldown.'),
snooze_until: zod.iso
.datetime({ offset: true })
.nullish()
.describe('ISO 8601 timestamp until which the alert is snoozed. Set to null to unsnooze.'),
})
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 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 repeated notifications after the alert fires. 0 means no cooldown.'),
snooze_until: zod.iso
.datetime({ offset: true })
.nullish()
.describe('ISO 8601 timestamp until which the alert is snoozed. Set to null to unsnooze.'),
})
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 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 repeated notifications after the alert fires. 0 means no cooldown.'),
snooze_until: zod.iso
.datetime({ offset: true })
.nullish()
.describe('ISO 8601 timestamp until which the alert is snoozed. Set to null to unsnooze.'),
})
/**
* Create a notification destination for this alert. One InsightsFunction is created per alert event kind (firing, resolved, ...) atomically.
*/
export const LogsAlertsDestinationsCreateBody = /* @__PURE__ */ zod.object({
type: zod
.enum(['slack', 'webhook', 'teams'])
.describe('\* `slack` - slack\n\* `webhook` - webhook\n\* `teams` - teams')
.describe('Notification destination type.\n\n\* `slack` - slack\n\* `webhook` - webhook\n\* `teams` - teams'),
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.'),
})
/**
* Delete a notification destination by deleting its InsightsFunction group atomically.
*/
export const logsAlertsDestinationsDeleteCreateBodyInsightsFunctionIdsMax = 4
export const LogsAlertsDestinationsDeleteCreateBody = /* @__PURE__ */ zod.object({
insights_function_ids: zod
.array(zod.uuid())
.min(1)
.max(logsAlertsDestinationsDeleteCreateBodyInsightsFunctionIdsMax)
.describe('InsightsFunction 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('Minutes to wait after firing before sending another notification.'),
date_from: zod.string().describe("Relative date string for how far back to simulate (e.g. '-24h', '-7d', '-30d')."),
})
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 \"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 \"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 /v1/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 or facetResourceAttribute. Its own filter is excluded so counts reflect the other active filters.\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 or facetResourceAttribute. Its own log_resource_attribute filter is excluded so counts reflect the other active filters."
),
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 \"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."
),
})
.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 \"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\", \"trace_id\", \"span_id\". 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\", \"trace_id\", \"span_id\".'
),
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.'),
})
.describe('The group-by query to execute.'),
})
export const logsMetricRulesCreateBodyNameMax = 255
export const logsMetricRulesCreateBodyMetricNameMax = 200
export const logsMetricRulesCreateBodyEnabledDefault = false
export const logsMetricRulesCreateBodyValueAttributeMax = 512
export const logsMetricRulesCreateBodyGroupByItemMax = 512
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(
'Log attribute key holding a numeric value to aggregate into a distribution (count + sum), e.g. `attributes.duration_ms` or `resource_attributes.batch.size`. Omit to count matching log 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. Allowed: service_name, severity_text, event_name, or map keys prefixed with `attributes.` \/ `resource_attributes.`. Avoid high-cardinality keys (user IDs, request IDs) — excess series are dropped at ingestion.'
),
})
export const logsMetricRulesUpdateBodyNameMax = 255
export const logsMetricRulesUpdateBodyMetricNameMax = 200
export const logsMetricRulesUpdateBodyEnabledDefault = false
export const logsMetricRulesUpdateBodyValueAttributeMax = 512
export const logsMetricRulesUpdateBodyGroupByItemMax = 512
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(
'Log attribute key holding a numeric value to aggregate into a distribution (count + sum), e.g. `attributes.duration_ms` or `resource_attributes.batch.size`. Omit to count matching log 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. Allowed: service_name, severity_text, event_name, or map keys prefixed with `attributes.` \/ `resource_attributes.`. Avoid high-cardinality keys (user IDs, request IDs) — excess series are dropped at ingestion.'
),
})
export const logsMetricRulesPartialUpdateBodyNameMax = 255
export const logsMetricRulesPartialUpdateBodyMetricNameMax = 200
export const logsMetricRulesPartialUpdateBodyEnabledDefault = false
export const logsMetricRulesPartialUpdateBodyValueAttributeMax = 512
export const logsMetricRulesPartialUpdateBodyGroupByItemMax = 512
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(
'Log attribute key holding a numeric value to aggregate into a distribution (count + sum), e.g. `attributes.duration_ms` or `resource_attributes.batch.size`. Omit to count matching log 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. Allowed: service_name, severity_text, event_name, or map keys prefixed with `attributes.` \/ `resource_attributes.`. Avoid high-cardinality keys (user IDs, request IDs) — excess series are dropped at ingestion.'
),
})
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 \"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.'),
})
.describe('The patterns query to execute.'),
})
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 \"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.'),
})
.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 logsQueryCreateBodyQueryOneFilterGroupDefault = []
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
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\". 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.'
),
})
)
.default(logsQueryCreateBodyQueryOneFilterGroupDefault)
.describe('Property filters for the query.'),
limit: zod.number().default(logsQueryCreateBodyQueryOneLimitDefault).describe('Max results (1-1000).'),
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 InsightsQL 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."
),
})
.describe('The logs query to execute.'),
})
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.'
),
})
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.'
),
})
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 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.'),
filterGroup: zod
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\". 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 services aggregation query to execute.'),
})
export const logsSparklineCreateBodyQueryOneSeverityLevelsDefault = []
export const logsSparklineCreateBodyQueryOneServiceNamesDefault = []
export const logsSparklineCreateBodyQueryOneFilterGroupDefault = []
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
.array(
zod.object({
key: zod
.string()
.describe(
'Attribute key. For type \"log\", use \"message\". 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.'
),
})
)
.default(logsSparklineCreateBodyQueryOneFilterGroupDefault)
.describe('Property filters for the query.'),
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."
),
})
.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', 'message', 'custom'])
.describe(
'\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\n\* `message` - message\n\* `custom` - custom'
)
.describe(
'Column type. Built-in types resolve client-side from log row fields; `custom` columns are computed server-side from `expression`.\n\n\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\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 InsightsQL 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', 'message', 'custom'])
.describe(
'\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\n\* `message` - message\n\* `custom` - custom'
)
.describe(
'Column type. Built-in types resolve client-side from log row fields; `custom` columns are computed server-side from `expression`.\n\n\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\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 InsightsQL 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', 'message', 'custom'])
.describe(
'\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\n\* `message` - message\n\* `custom` - custom'
)
.describe(
'Column type. Built-in types resolve client-side from log row fields; `custom` columns are computed server-side from `expression`.\n\n\* `timestamp` - timestamp\n\* `level` - level\n\* `source` - source\n\* `trace_id` - trace_id\n\* `span_id` - span_id\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 InsightsQL 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(),
})