Skip to content

: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.

fix(logs): make the query and sparkline schemas match the api (#113378)

Frank Hamand03556d40129d
diff --git a/products/logs/backend/presentation/views/api.py b/products/logs/backend/presentation/views/api.py
index 7ff642f2681f..9b0eed792dc8 100644
--- a/products/logs/backend/presentation/views/api.py
+++ b/products/logs/backend/presentation/views/api.py
@@ -7,7 +7,7 @@ from django.db import models
from django.utils import timezone
from drf_spectacular.types import OpenApiTypes
-from drf_spectacular.utils import extend_schema
+from drf_spectacular.utils import PolymorphicProxySerializer, extend_schema, extend_schema_field
from opentelemetry import trace
from pydantic import ValidationError
from rest_framework import serializers, status, viewsets
@@ -21,7 +21,7 @@ from posthog.schema import DateRange, LogAttributesQuery, LogsOrderBy, LogsQuery
from posthog.hogql.errors import QueryError
-from posthog.api.documentation import _FallbackSerializer
+from posthog.api.documentation import PropertyGroupOperator, _FallbackSerializer
from posthog.api.mixins import PydanticModelMixin
from posthog.api.property_value_metrics import PROPERTY_VALUES_DURATION
from posthog.api.routing import TeamAndOrgViewSetMixin
@@ -196,6 +196,33 @@ class _LogPropertyFilterSerializer(serializers.Serializer):
)
+class _LogsFilterInnerGroupSerializer(serializers.Serializer):
+ type = serializers.ChoiceField(
+ choices=PropertyGroupOperator.choices, help_text="How to combine the filters in `values`."
+ )
+ values = _LogPropertyFilterSerializer(many=True, help_text="Property filters in this group.")
+
+
+class _LogsFilterGroupSerializer(serializers.Serializer):
+ type = serializers.ChoiceField(
+ choices=PropertyGroupOperator.choices, help_text="How to combine the groups in `values`."
+ )
+ values = _LogsFilterInnerGroupSerializer(many=True, help_text="Groups of property filters.")
+
+
+# `_normalize_filter_group` accepts both forms and reads a flat list as one AND group.
+@extend_schema_field(
+ PolymorphicProxySerializer(
+ component_name="LogsFilterGroupInput",
+ serializers=[_LogPropertyFilterSerializer(many=True), _LogsFilterGroupSerializer],
+ resource_type_field_name=None,
+ many=False,
+ )
+)
+class _LogsFilterGroupField(serializers.JSONField):
+ pass
+
+
class _LogsAttributesQuerySerializer(serializers.Serializer):
search = serializers.CharField(required=False, help_text="Search filter for attribute names")
search_values = serializers.BooleanField(
@@ -318,11 +345,12 @@ class _LogsQueryBodySerializer(serializers.Serializer):
help_text="Order results by timestamp.",
)
searchTerm = serializers.CharField(required=False, help_text="Full-text search term to filter log bodies.")
- filterGroup = serializers.ListField(
- child=_LogPropertyFilterSerializer(),
+ filterGroup = _LogsFilterGroupField(
required=False,
- default=[],
- help_text="Property filters for the query.",
+ help_text=(
+ "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 = serializers.IntegerField(required=False, default=100, help_text="Max results (1-1000).")
after = serializers.CharField(required=False, help_text="Pagination cursor from previous response.")
@@ -368,11 +396,12 @@ class _LogsSparklineBodySerializer(serializers.Serializer):
help_text="Filter by service names.",
)
searchTerm = serializers.CharField(required=False, help_text="Full-text search term to filter log bodies.")
- filterGroup = serializers.ListField(
- child=_LogPropertyFilterSerializer(),
+ filterGroup = _LogsFilterGroupField(
required=False,
- default=[],
- help_text="Property filters for the query.",
+ help_text=(
+ "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 = serializers.ChoiceField(
choices=["severity", "service"],
@@ -684,7 +713,6 @@ class _LogEntrySerializer(serializers.Serializer):
span_id = serializers.CharField(
help_text='Span ID. Returns "0000000000000000" when not set (padding, not null).',
)
- trace_flags = serializers.IntegerField(required=False, help_text="OpenTelemetry trace flags.")
attributes = serializers.DictField(
child=serializers.CharField(allow_blank=True),
help_text="Log-level attributes as a string-keyed map. Values are strings (numeric/datetime attributes are also accessible via materialized columns).",
@@ -694,6 +722,19 @@ class _LogEntrySerializer(serializers.Serializer):
help_text="Resource-level attributes (service.name, k8s.*, host.hostname, etc.) as a string-keyed map. Repeats across all logs from the same pod/host.",
)
event_name = serializers.CharField(required=False, allow_blank=True, help_text="OpenTelemetry event name, if set.")
+ instrumentation_scope = serializers.CharField(
+ allow_blank=True, help_text="OpenTelemetry instrumentation scope name. Empty when not set."
+ )
+ resource_fingerprint = serializers.CharField(
+ help_text="Hash of the resource attributes. Logs from the same pod or host share it."
+ )
+ live_logs_checkpoint = serializers.DateTimeField(
+ allow_null=True,
+ help_text=(
+ "Latest timestamp up to which ingestion is known to be complete. The same on every row. "
+ "Logs newer than it can still arrive."
+ ),
+ )
class _LogsQueryResponseSerializer(serializers.Serializer):
@@ -735,20 +776,13 @@ class _LogsSparklineBucketSerializer(serializers.Serializer):
required=False,
help_text='Service name when sparklineBreakdownBy="service". Present only for service-broken-down sparklines.',
)
- count = serializers.IntegerField()
+ count = serializers.IntegerField(help_text="Number of log entries in the bucket.")
bytes_uncompressed = serializers.IntegerField(
required=False,
help_text="Sum of uncompressed bytes for the bucket.",
)
-class _LogsSparklineResponseSerializer(serializers.Serializer):
- results = _LogsSparklineBucketSerializer(
- many=True,
- help_text="Time-bucketed log counts. Each bucket carries either `severity` or `service` depending on breakdown.",
- )
-
-
class _LogsServiceSeverityBreakdownSerializer(serializers.Serializer):
debug = serializers.IntegerField()
info = serializers.IntegerField()
@@ -1504,7 +1538,10 @@ class LogsViewSet(TeamAndOrgViewSetMixin, PydanticModelMixin, viewsets.ViewSet):
status=200,
)
- @extend_schema(request=_LogsSparklineRequestSerializer, responses={200: _LogsSparklineResponseSerializer})
+ @extend_schema(
+ request=_LogsSparklineRequestSerializer,
+ responses={200: _LogsSparklineBucketSerializer(many=True)},
+ )
@action(detail=False, methods=["POST"], required_scopes=["logs:read"])
def sparkline(self, request: Request, *args, **kwargs) -> Response:
tag_queries(product=Product.LOGS, feature=Feature.QUERY)
diff --git a/products/logs/frontend/generated/api.schemas.ts b/products/logs/frontend/generated/api.schemas.ts
index 760f9431c043..14df96529898 100644
--- a/products/logs/frontend/generated/api.schemas.ts
+++ b/products/logs/frontend/generated/api.schemas.ts
@@ -2306,6 +2306,36 @@ export const OrderByEnumApi = {
Earliest: 'earliest',
} as const
+export type PropertyGroupOperatorEnumApi =
+ (typeof PropertyGroupOperatorEnumApi)[keyof typeof PropertyGroupOperatorEnumApi]
+
+export const PropertyGroupOperatorEnumApi = {
+ And: 'AND',
+ Or: 'OR',
+} as const
+
+export interface _LogsFilterInnerGroupApi {
+ /** How to combine the filters in `values`.
+ *
+ * * `AND` - AND
+ * * `OR` - OR */
+ type: PropertyGroupOperatorEnumApi
+ /** Property filters in this group. */
+ values: _LogPropertyFilterApi[]
+}
+
+export interface _LogsFilterGroupApi {
+ /** How to combine the groups in `values`.
+ *
+ * * `AND` - AND
+ * * `OR` - OR */
+ type: PropertyGroupOperatorEnumApi
+ /** Groups of property filters. */
+ values: _LogsFilterInnerGroupApi[]
+}
+
+export type LogsFilterGroupInputApi = _LogPropertyFilterApi[] | _LogsFilterGroupApi
+
export interface _LogsQueryBodyApi {
/** Date range for the query. Defaults to last hour. */
dateRange?: _DateRangeApi
@@ -2320,8 +2350,8 @@ export interface _LogsQueryBodyApi {
orderBy?: OrderByEnumApi
/** Full-text search term to filter log bodies. */
searchTerm?: string
- /** Property filters for the query. */
- filterGroup?: _LogPropertyFilterApi[]
+ /** 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. */
+ filterGroup?: LogsFilterGroupInputApi
/** Max results (1-1000). */
limit?: number
/** Pagination cursor from previous response. */
@@ -2373,14 +2403,21 @@ export interface _LogEntryApi {
trace_id: string
/** Span ID. Returns "0000000000000000" when not set (padding, not null). */
span_id: string
- /** OpenTelemetry trace flags. */
- trace_flags?: number
/** Log-level attributes as a string-keyed map. Values are strings (numeric/datetime attributes are also accessible via materialized columns). */
attributes: _LogEntryApiAttributes
/** Resource-level attributes (service.name, k8s.*, host.hostname, etc.) as a string-keyed map. Repeats across all logs from the same pod/host. */
resource_attributes: _LogEntryApiResourceAttributes
/** OpenTelemetry event name, if set. */
event_name?: string
+ /** OpenTelemetry instrumentation scope name. Empty when not set. */
+ instrumentation_scope: string
+ /** Hash of the resource attributes. Logs from the same pod or host share it. */
+ resource_fingerprint: string
+ /**
+ * Latest timestamp up to which ingestion is known to be complete. The same on every row. Logs newer than it can still arrive.
+ * @nullable
+ */
+ live_logs_checkpoint: string | null
}
export interface _LogsQueryResponseApi {
@@ -2722,8 +2759,8 @@ export interface _LogsSparklineBodyApi {
serviceNames?: string[]
/** Full-text search term to filter log bodies. */
searchTerm?: string
- /** Property filters for the query. */
- filterGroup?: _LogPropertyFilterApi[]
+ /** 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. */
+ filterGroup?: LogsFilterGroupInputApi
/** Break down sparkline by "severity" (default) or "service".
*
* * `severity` - severity
@@ -2752,16 +2789,12 @@ export interface _LogsSparklineBucketApi {
severity?: string
/** Service name when sparklineBreakdownBy="service". Present only for service-broken-down sparklines. */
service?: string
+ /** Number of log entries in the bucket. */
count: number
/** Sum of uncompressed bytes for the bucket. */
bytes_uncompressed?: number
}
-export interface _LogsSparklineResponseApi {
- /** Time-bucketed log counts. Each bucket carries either `severity` or `service` depending on breakdown. */
- results: _LogsSparklineBucketApi[]
-}
-
export interface _LogAttributeValueApi {
/** Attribute value (used as the identifier). */
id: string
diff --git a/products/logs/frontend/generated/api.ts b/products/logs/frontend/generated/api.ts
index a4867e6cc4d3..64c22db49a1d 100644
--- a/products/logs/frontend/generated/api.ts
+++ b/products/logs/frontend/generated/api.ts
@@ -74,8 +74,8 @@ import type {
_LogsQueryResponseApi,
_LogsServicesRequestApi,
_LogsServicesResponseApi,
+ _LogsSparklineBucketApi,
_LogsSparklineRequestApi,
- _LogsSparklineResponseApi,
_LogsValuesResponseApi,
} from './api.schemas'
@@ -1109,8 +1109,8 @@ export const logsSparklineCreate = async (
projectId: string,
_logsSparklineRequestApi: _LogsSparklineRequestApi,
options?: RequestInit
-): Promise<_LogsSparklineResponseApi> => {
- return apiMutator<_LogsSparklineResponseApi>(getLogsSparklineCreateUrl(projectId), {
+): Promise<_LogsSparklineBucketApi[]> => {
+ return apiMutator<_LogsSparklineBucketApi[]>(getLogsSparklineCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
diff --git a/products/logs/frontend/generated/api.zod.ts b/products/logs/frontend/generated/api.zod.ts
index c335db318db1..fc75da911ebb 100644
--- a/products/logs/frontend/generated/api.zod.ts
+++ b/products/logs/frontend/generated/api.zod.ts
@@ -1563,7 +1563,6 @@ export const LogsPatternsDiffCreateBody = /* @__PURE__ */ zod.object({
export const logsQueryCreateBodyQueryOneSeverityLevelsDefault = []
export const logsQueryCreateBodyQueryOneServiceNamesDefault = []
-export const logsQueryCreateBodyQueryOneFilterGroupDefault = []
export const logsQueryCreateBodyQueryOneLimitDefault = 100
export const logsQueryCreateBodyQueryOneExcludeAttributesDefault = false
export const logsQueryCreateBodyQueryOneCustomColumnsDefault = []
@@ -1607,57 +1606,128 @@ export const LogsQueryCreateBody = /* @__PURE__ */ zod.object({
.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(
+ .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({
- 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'
+ .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(
- '\"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.'),
+ .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().default(logsQueryCreateBodyQueryOneLimitDefault).describe('Max results (1-1000).'),
after: zod.string().optional().describe('Pagination cursor from previous response.'),
excludeAttributes: zod
@@ -2084,7 +2154,6 @@ export const LogsServicesCreateBody = /* @__PURE__ */ zod.object({
export const logsSparklineCreateBodyQueryOneSeverityLevelsDefault = []
export const logsSparklineCreateBodyQueryOneServiceNamesDefault = []
-export const logsSparklineCreateBodyQueryOneFilterGroupDefault = []
export const LogsSparklineCreateBody = /* @__PURE__ */ zod.object({
query: zod
@@ -2120,57 +2189,128 @@ export const LogsSparklineCreateBody = /* @__PURE__ */ zod.object({
.describe('Filter by service names.'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies.'),
filterGroup: zod
- .array(
+ .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({
- 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'
+ .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(
- '\"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.'),
+ .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')
diff --git a/products/logs/mcp/tools.yaml b/products/logs/mcp/tools.yaml
index 3ca34c70f57c..aad679817281 100644
--- a/products/logs/mcp/tools.yaml
+++ b/products/logs/mcp/tools.yaml
@@ -478,9 +478,6 @@ tools:
idempotent: true
title: Query logs sparkline
description_file: ./prompts/logs-sparkline.md
- response:
- include:
- - results
query-logs:
operation: logs_query_create
enabled: true
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 41c1f12905bc..f8949a0eaa39 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -61238,6 +61238,117 @@ export namespace Schemas {
RateLimit: 'rate_limit',
} as const;
+ /**
+ * * `log` - log
+ * * `log_attribute` - log_attribute
+ * * `log_resource_attribute` - log_resource_attribute
+ */
+ export type _LogPropertyFilterTypeEnum = typeof _LogPropertyFilterTypeEnum[keyof typeof _LogPropertyFilterTypeEnum];
+
+
+ export const _LogPropertyFilterTypeEnum = {
+ Log: 'log',
+ LogAttribute: 'log_attribute',
+ LogResourceAttribute: 'log_resource_attribute',
+ } as const;
+
+ /**
+ * * `exact` - exact
+ * * `is_not` - is_not
+ * * `icontains` - icontains
+ * * `not_icontains` - not_icontains
+ * * `starts_with` - starts_with
+ * * `not_starts_with` - not_starts_with
+ * * `ends_with` - ends_with
+ * * `not_ends_with` - not_ends_with
+ * * `regex` - regex
+ * * `not_regex` - not_regex
+ * * `gt` - gt
+ * * `lt` - lt
+ * * `is_date_exact` - is_date_exact
+ * * `is_date_before` - is_date_before
+ * * `is_date_after` - is_date_after
+ * * `is_set` - is_set
+ * * `is_not_set` - is_not_set
+ */
+ export type _LogPropertyFilterOperatorEnum = typeof _LogPropertyFilterOperatorEnum[keyof typeof _LogPropertyFilterOperatorEnum];
+
+
+ export const _LogPropertyFilterOperatorEnum = {
+ Exact: 'exact',
+ IsNot: 'is_not',
+ Icontains: 'icontains',
+ NotIcontains: 'not_icontains',
+ StartsWith: 'starts_with',
+ NotStartsWith: 'not_starts_with',
+ EndsWith: 'ends_with',
+ NotEndsWith: 'not_ends_with',
+ Regex: 'regex',
+ NotRegex: 'not_regex',
+ Gt: 'gt',
+ Lt: 'lt',
+ IsDateExact: 'is_date_exact',
+ IsDateBefore: 'is_date_before',
+ IsDateAfter: 'is_date_after',
+ IsSet: 'is_set',
+ IsNotSet: 'is_not_set',
+ } as const;
+
+ export interface _LogPropertyFilter {
+ /** 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"). */
+ key: string;
+ /** "log" filters the log body/message. "log_attribute" filters log-level attributes. "log_resource_attribute" filters resource-level attributes.
+ *
+ * * `log` - log
+ * * `log_attribute` - log_attribute
+ * * `log_resource_attribute` - log_resource_attribute */
+ type: _LogPropertyFilterTypeEnum;
+ /** Comparison operator.
+ *
+ * * `exact` - exact
+ * * `is_not` - is_not
+ * * `icontains` - icontains
+ * * `not_icontains` - not_icontains
+ * * `starts_with` - starts_with
+ * * `not_starts_with` - not_starts_with
+ * * `ends_with` - ends_with
+ * * `not_ends_with` - not_ends_with
+ * * `regex` - regex
+ * * `not_regex` - not_regex
+ * * `gt` - gt
+ * * `lt` - lt
+ * * `is_date_exact` - is_date_exact
+ * * `is_date_before` - is_date_before
+ * * `is_date_after` - is_date_after
+ * * `is_set` - is_set
+ * * `is_not_set` - is_not_set */
+ operator: _LogPropertyFilterOperatorEnum;
+ /** Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators. */
+ value?: unknown;
+ }
+
+ export interface _LogsFilterInnerGroup {
+ /** How to combine the filters in `values`.
+ *
+ * * `AND` - AND
+ * * `OR` - OR */
+ type: PropertyGroupOperatorEnum;
+ /** Property filters in this group. */
+ values: _LogPropertyFilter[];
+ }
+
+ export interface _LogsFilterGroup {
+ /** How to combine the groups in `values`.
+ *
+ * * `AND` - AND
+ * * `OR` - OR */
+ type: PropertyGroupOperatorEnum;
+ /** Groups of property filters. */
+ values: _LogsFilterInnerGroup[];
+ }
+
+ export type LogsFilterGroupInput = _LogPropertyFilter[] | _LogsFilterGroup;
+
/**
* * `log` - log
* * `resource` - resource
@@ -111027,14 +111138,21 @@ export namespace Schemas {
trace_id: string;
/** Span ID. Returns "0000000000000000" when not set (padding, not null). */
span_id: string;
- /** OpenTelemetry trace flags. */
- trace_flags?: number;
/** Log-level attributes as a string-keyed map. Values are strings (numeric/datetime attributes are also accessible via materialized columns). */
attributes: _LogEntryAttributes;
/** Resource-level attributes (service.name, k8s.*, host.hostname, etc.) as a string-keyed map. Repeats across all logs from the same pod/host. */
resource_attributes: _LogEntryResourceAttributes;
/** OpenTelemetry event name, if set. */
event_name?: string;
+ /** OpenTelemetry instrumentation scope name. Empty when not set. */
+ instrumentation_scope: string;
+ /** Hash of the resource attributes. Logs from the same pod or host share it. */
+ resource_fingerprint: string;
+ /**
+ * Latest timestamp up to which ingestion is known to be complete. The same on every row. Logs newer than it can still arrive.
+ * @nullable
+ */
+ live_logs_checkpoint: string | null;
}
export interface _LogFacetValue {
@@ -111147,95 +111265,6 @@ export namespace Schemas {
baseline_volume_share_pct: number | null;
}
- /**
- * * `log` - log
- * * `log_attribute` - log_attribute
- * * `log_resource_attribute` - log_resource_attribute
- */
- export type _LogPropertyFilterTypeEnum = typeof _LogPropertyFilterTypeEnum[keyof typeof _LogPropertyFilterTypeEnum];
-
-
- export const _LogPropertyFilterTypeEnum = {
- Log: 'log',
- LogAttribute: 'log_attribute',
- LogResourceAttribute: 'log_resource_attribute',
- } as const;
-
- /**
- * * `exact` - exact
- * * `is_not` - is_not
- * * `icontains` - icontains
- * * `not_icontains` - not_icontains
- * * `starts_with` - starts_with
- * * `not_starts_with` - not_starts_with
- * * `ends_with` - ends_with
- * * `not_ends_with` - not_ends_with
- * * `regex` - regex
- * * `not_regex` - not_regex
- * * `gt` - gt
- * * `lt` - lt
- * * `is_date_exact` - is_date_exact
- * * `is_date_before` - is_date_before
- * * `is_date_after` - is_date_after
- * * `is_set` - is_set
- * * `is_not_set` - is_not_set
- */
- export type _LogPropertyFilterOperatorEnum = typeof _LogPropertyFilterOperatorEnum[keyof typeof _LogPropertyFilterOperatorEnum];
-
-
- export const _LogPropertyFilterOperatorEnum = {
- Exact: 'exact',
- IsNot: 'is_not',
- Icontains: 'icontains',
- NotIcontains: 'not_icontains',
- StartsWith: 'starts_with',
- NotStartsWith: 'not_starts_with',
- EndsWith: 'ends_with',
- NotEndsWith: 'not_ends_with',
- Regex: 'regex',
- NotRegex: 'not_regex',
- Gt: 'gt',
- Lt: 'lt',
- IsDateExact: 'is_date_exact',
- IsDateBefore: 'is_date_before',
- IsDateAfter: 'is_date_after',
- IsSet: 'is_set',
- IsNotSet: 'is_not_set',
- } as const;
-
- export interface _LogPropertyFilter {
- /** 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"). */
- key: string;
- /** "log" filters the log body/message. "log_attribute" filters log-level attributes. "log_resource_attribute" filters resource-level attributes.
- *
- * * `log` - log
- * * `log_attribute` - log_attribute
- * * `log_resource_attribute` - log_resource_attribute */
- type: _LogPropertyFilterTypeEnum;
- /** Comparison operator.
- *
- * * `exact` - exact
- * * `is_not` - is_not
- * * `icontains` - icontains
- * * `not_icontains` - not_icontains
- * * `starts_with` - starts_with
- * * `not_starts_with` - not_starts_with
- * * `ends_with` - ends_with
- * * `not_ends_with` - not_ends_with
- * * `regex` - regex
- * * `not_regex` - not_regex
- * * `gt` - gt
- * * `lt` - lt
- * * `is_date_exact` - is_date_exact
- * * `is_date_before` - is_date_before
- * * `is_date_after` - is_date_after
- * * `is_set` - is_set
- * * `is_not_set` - is_not_set */
- operator: _LogPropertyFilterOperatorEnum;
- /** Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators. */
- value?: unknown;
- }
-
export interface _LogsAttributesResponse {
/** Available attribute keys matching the filters. */
results: _LogAttributeEntry[];
@@ -111630,8 +111659,8 @@ export namespace Schemas {
orderBy?: OrderByEnum;
/** Full-text search term to filter log bodies. */
searchTerm?: string;
- /** Property filters for the query. */
- filterGroup?: _LogPropertyFilter[];
+ /** 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. */
+ filterGroup?: LogsFilterGroupInput;
/** Max results (1-1000). */
limit?: number;
/** Pagination cursor from previous response. */
@@ -111764,8 +111793,8 @@ export namespace Schemas {
serviceNames?: string[];
/** Full-text search term to filter log bodies. */
searchTerm?: string;
- /** Property filters for the query. */
- filterGroup?: _LogPropertyFilter[];
+ /** 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. */
+ filterGroup?: LogsFilterGroupInput;
/** Break down sparkline by "severity" (default) or "service".
*
* * `severity` - severity
@@ -111789,6 +111818,7 @@ export namespace Schemas {
severity?: string;
/** Service name when sparklineBreakdownBy="service". Present only for service-broken-down sparklines. */
service?: string;
+ /** Number of log entries in the bucket. */
count: number;
/** Sum of uncompressed bytes for the bucket. */
bytes_uncompressed?: number;
@@ -111799,11 +111829,6 @@ export namespace Schemas {
query: _LogsSparklineBody;
}
- export interface _LogsSparklineResponse {
- /** Time-bucketed log counts. Each bucket carries either `severity` or `service` depending on breakdown. */
- results: _LogsSparklineBucket[];
- }
-
export interface _LogsValuesResponse {
/** Distinct values observed for the requested attribute. */
results: _LogAttributeValue[];
diff --git a/services/mcp/src/generated/logs/api.ts b/services/mcp/src/generated/logs/api.ts
index 15565bb130e7..c4fbaf7cd551 100644
--- a/services/mcp/src/generated/logs/api.ts
+++ b/services/mcp/src/generated/logs/api.ts
@@ -6212,7 +6212,6 @@ export const LogsQueryCreateParams = () => zod.object({
export const logsQueryCreateBodyQueryOneSeverityLevelsDefault = []
export const logsQueryCreateBodyQueryOneServiceNamesDefault = []
-export const logsQueryCreateBodyQueryOneFilterGroupDefault = []
export const logsQueryCreateBodyQueryOneLimitDefault = 100
export const logsQueryCreateBodyQueryOneExcludeAttributesDefault = false
export const logsQueryCreateBodyQueryOneCustomColumnsDefault = []
@@ -6256,57 +6255,128 @@ export const LogsQueryCreateBody = () => zod.object({
.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(
+ .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({
- 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'
+ .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(
- '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.'),
+ .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().default(logsQueryCreateBodyQueryOneLimitDefault).describe('Max results (1-1000).'),
after: zod.string().optional().describe('Pagination cursor from previous response.'),
excludeAttributes: zod
@@ -6453,7 +6523,6 @@ export const LogsSparklineCreateParams = () => zod.object({
export const logsSparklineCreateBodyQueryOneSeverityLevelsDefault = []
export const logsSparklineCreateBodyQueryOneServiceNamesDefault = []
-export const logsSparklineCreateBodyQueryOneFilterGroupDefault = []
export const LogsSparklineCreateBody = () => zod.object({
query: zod
@@ -6489,57 +6558,128 @@ export const LogsSparklineCreateBody = () => zod.object({
.describe('Filter by service names.'),
searchTerm: zod.string().optional().describe('Full-text search term to filter log bodies.'),
filterGroup: zod
- .array(
+ .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({
- 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'
+ .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(
- '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.'),
+ .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')
diff --git a/services/mcp/src/tools/generated/logs.ts b/services/mcp/src/tools/generated/logs.ts
index 89954e27d132..242c703edfb7 100644
--- a/services/mcp/src/tools/generated/logs.ts
+++ b/services/mcp/src/tools/generated/logs.ts
@@ -771,7 +771,7 @@ const LogsSparklineQuerySchema = () => {
const logsSparklineQuery = (): ToolBase<
ReturnType<typeof LogsSparklineQuerySchema>,
- Schemas._LogsSparklineResponse
+ Schemas._LogsSparklineBucket[]
> => ({
name: 'logs-sparkline-query',
schema: LogsSparklineQuerySchema(),
@@ -781,13 +781,12 @@ const logsSparklineQuery = (): ToolBase<
if (params.query !== undefined) {
body['query'] = params.query
}
- const result = await context.api.request<Schemas._LogsSparklineResponse>({
+ const result = await context.api.request<Schemas._LogsSparklineBucket[]>({
method: 'POST',
path: `/api/projects/${encodeURIComponent(String(projectId))}/logs/sparkline/`,
body,
})
- const filtered = pickResponseFields(result, ['results']) as typeof result
- return filtered
+ return result
},
})
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/logs-sparkline-query.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/logs-sparkline-query.json
index 5572cec5a688..13cf3d491794 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/logs-sparkline-query.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/logs-sparkline-query.json
@@ -33,50 +33,124 @@
"type": "object"
},
"filterGroup": {
- "default": [],
- "description": "Property filters for the query.",
- "items": {
- "properties": {
- "key": {
- "description": "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": "string"
- },
- "operator": {
- "description": "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",
- "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"
- ],
- "type": "string"
- },
- "type": {
- "description": "\"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",
- "enum": ["log", "log_attribute", "log_resource_attribute"],
- "type": "string"
+ "anyOf": [
+ {
+ "items": {
+ "properties": {
+ "key": {
+ "description": "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": "string"
+ },
+ "operator": {
+ "description": "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",
+ "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"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "description": "\"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",
+ "enum": ["log", "log_attribute", "log_resource_attribute"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators."
+ }
+ },
+ "required": ["key", "type", "operator"],
+ "type": "object"
},
- "value": {
- "description": "Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators."
- }
+ "type": "array"
},
- "required": ["key", "type", "operator"],
- "type": "object"
- },
- "type": "array"
+ {
+ "properties": {
+ "type": {
+ "description": "How to combine the groups in `values`.\n\n* `AND` - AND\n* `OR` - OR",
+ "enum": ["AND", "OR"],
+ "type": "string"
+ },
+ "values": {
+ "description": "Groups of property filters.",
+ "items": {
+ "properties": {
+ "type": {
+ "description": "How to combine the filters in `values`.\n\n* `AND` - AND\n* `OR` - OR",
+ "enum": ["AND", "OR"],
+ "type": "string"
+ },
+ "values": {
+ "description": "Property filters in this group.",
+ "items": {
+ "properties": {
+ "key": {
+ "description": "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": "string"
+ },
+ "operator": {
+ "description": "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",
+ "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"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "description": "\"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",
+ "enum": ["log", "log_attribute", "log_resource_attribute"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators."
+ }
+ },
+ "required": ["key", "type", "operator"],
+ "type": "object"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["type", "values"],
+ "type": "object"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["type", "values"],
+ "type": "object"
+ }
+ ],
+ "description": "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."
},
"personId": {
"description": "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.",
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-logs.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-logs.json
index 4f7b8b341949..345b117bf122 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/query-logs.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/query-logs.json
@@ -50,50 +50,124 @@
"type": "boolean"
},
"filterGroup": {
- "default": [],
- "description": "Property filters for the query.",
- "items": {
- "properties": {
- "key": {
- "description": "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": "string"
- },
- "operator": {
- "description": "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",
- "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"
- ],
- "type": "string"
- },
- "type": {
- "description": "\"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",
- "enum": ["log", "log_attribute", "log_resource_attribute"],
- "type": "string"
+ "anyOf": [
+ {
+ "items": {
+ "properties": {
+ "key": {
+ "description": "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": "string"
+ },
+ "operator": {
+ "description": "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",
+ "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"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "description": "\"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",
+ "enum": ["log", "log_attribute", "log_resource_attribute"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators."
+ }
+ },
+ "required": ["key", "type", "operator"],
+ "type": "object"
},
- "value": {
- "description": "Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators."
- }
+ "type": "array"
},
- "required": ["key", "type", "operator"],
- "type": "object"
- },
- "type": "array"
+ {
+ "properties": {
+ "type": {
+ "description": "How to combine the groups in `values`.\n\n* `AND` - AND\n* `OR` - OR",
+ "enum": ["AND", "OR"],
+ "type": "string"
+ },
+ "values": {
+ "description": "Groups of property filters.",
+ "items": {
+ "properties": {
+ "type": {
+ "description": "How to combine the filters in `values`.\n\n* `AND` - AND\n* `OR` - OR",
+ "enum": ["AND", "OR"],
+ "type": "string"
+ },
+ "values": {
+ "description": "Property filters in this group.",
+ "items": {
+ "properties": {
+ "key": {
+ "description": "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": "string"
+ },
+ "operator": {
+ "description": "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",
+ "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"
+ ],
+ "type": "string"
+ },
+ "type": {
+ "description": "\"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",
+ "enum": ["log", "log_attribute", "log_resource_attribute"],
+ "type": "string"
+ },
+ "value": {
+ "description": "Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators."
+ }
+ },
+ "required": ["key", "type", "operator"],
+ "type": "object"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["type", "values"],
+ "type": "object"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["type", "values"],
+ "type": "object"
+ }
+ ],
+ "description": "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": {
"default": 100,