> ## Documentation Index
> Fetch the complete documentation index at: https://ancplua.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Post apiv1logsaggregate

> Aggregate logs



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/v1/logs/aggregate
openapi: 3.0.0
info:
  title: QYL Observability API
  version: '2026-01-26'
servers:
  - url: https://api.staging.qyl.dev
    description: QYL Staging API
    variables: {}
  - url: https://api.qyl.dev
    description: QYL Production API
    variables: {}
security: []
tags:
  - name: Streaming
  - name: Traces
  - name: Logs
  - name: Metrics
  - name: Sessions
  - name: Errors
  - name: Deployments
  - name: Services
  - name: Health
  - name: Workspaces
  - name: Onboarding
  - name: Configurator
  - name: Issues
  - name: Workflows
  - name: Search
  - name: Alerts
paths:
  /api/v1/logs/aggregate:
    post:
      tags:
        - Logs
      description: Aggregate logs
      operationId: LogsApi_aggregate
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LogAggregationRequest'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogAggregationResponse'
        '400':
          description: Bad request - validation failed (400)
          headers:
            X-Trace-Id:
              required: false
              description: Trace ID for correlation
              schema:
                type: string
            X-Request-Id:
              required: false
              description: Request ID for support
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Qyl.Common.Errors.ValidationError'
        '500':
          description: Internal server error (500)
          headers:
            X-Trace-Id:
              required: false
              description: Trace ID for correlation
              schema:
                type: string
            X-Request-Id:
              required: false
              description: Request ID for support
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Qyl.Common.Errors.InternalServerError'
components:
  schemas:
    LogAggregationRequest:
      type: object
      required:
        - aggregation
      properties:
        query:
          allOf:
            - $ref: '#/components/schemas/Qyl.Domains.Observe.Log.LogQuery'
          description: Query filters
        aggregation:
          allOf:
            - $ref: '#/components/schemas/Qyl.Domains.Observe.Log.LogAggregation'
          description: Aggregation specification
      description: Log aggregation request
    LogAggregationResponse:
      type: object
      required:
        - results
        - total_count
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/LogAggregationBucket'
          description: Aggregation results
        total_count:
          allOf:
            - $ref: '#/components/schemas/Qyl.Common.Count'
          description: Total matching logs
      description: Log aggregation response
    Qyl.Common.Errors.ValidationError:
      type: object
      required:
        - title
        - errors
      properties:
        title:
          type: string
          enum:
            - Validation Failed
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Qyl.Common.Errors.ValidationErrorDetail'
          description: List of validation errors
      allOf:
        - $ref: '#/components/schemas/Qyl.Common.Errors.ProblemDetails'
      description: Bad request - validation failed (400)
    Qyl.Common.Errors.InternalServerError:
      type: object
      required:
        - title
      properties:
        title:
          type: string
          enum:
            - Internal Server Error
        error_code:
          type: string
          description: Error code for support reference
      allOf:
        - $ref: '#/components/schemas/Qyl.Common.Errors.ProblemDetails'
      description: Internal server error (500)
    Qyl.Domains.Observe.Log.LogQuery:
      type: object
      properties:
        query:
          type: string
          description: Free text search
        severity_min:
          allOf:
            - $ref: '#/components/schemas/Qyl.OTel.Enums.SeverityNumber'
          description: Severity filter
        service_name:
          type: string
          description: Service name filter
        trace_id:
          allOf:
            - $ref: '#/components/schemas/Qyl.Common.TraceId'
          description: Trace ID filter
        span_id:
          allOf:
            - $ref: '#/components/schemas/Qyl.Common.SpanId'
          description: Span ID filter
        time_start:
          type: string
          format: date-time
          description: Time range start
        time_end:
          type: string
          format: date-time
          description: Time range end
        attribute_filters:
          type: array
          items:
            $ref: '#/components/schemas/Qyl.Domains.Observe.Log.AttributeFilter'
          description: Attribute filters
        limit:
          type: integer
          format: int32
          minimum: 1
          maximum: 10000
          description: Limit
        order_by:
          allOf:
            - $ref: '#/components/schemas/Qyl.Domains.Observe.Log.LogOrderBy'
          description: Order by
      description: Log search query
    Qyl.Domains.Observe.Log.LogAggregation:
      type: object
      required:
        - group_by
        - function
      properties:
        group_by:
          type: array
          items:
            type: string
          description: Group by fields
        function:
          allOf:
            - $ref: '#/components/schemas/Qyl.Domains.Observe.Log.AggregationFunction'
          description: Aggregation function
        field:
          type: string
          description: Field to aggregate (for non-count)
        time_bucket:
          allOf:
            - $ref: '#/components/schemas/Qyl.Domains.Observe.Log.TimeBucket'
          description: Time bucket (for time series)
        top_n:
          type: integer
          format: int32
          description: Top N results
      description: Log aggregation request
    LogAggregationBucket:
      type: object
      required:
        - key
        - value
        - count
      properties:
        key:
          type: string
          description: Bucket key (group by value)
        value:
          type: number
          format: double
          description: Aggregated value
        count:
          allOf:
            - $ref: '#/components/schemas/Qyl.Common.Count'
          description: Document count
        timestamp:
          type: string
          format: date-time
          description: Timestamp (for time series)
      description: Log aggregation bucket
    Qyl.Common.Count:
      type: integer
      format: int64
      minimum: 0
      description: Generic non-negative counter
      x-csharp-type: long
      x-duckdb-type: BIGINT
    Qyl.Common.Errors.ValidationErrorDetail:
      type: object
      required:
        - field
        - message
        - code
      properties:
        field:
          type: string
          description: The field/property that failed validation
        message:
          type: string
          description: The error message
        code:
          type: string
          description: The validation rule that failed
        rejected_value:
          type: string
          description: The rejected value (if safe to include)
      description: Individual validation error detail
    Qyl.Common.Errors.ProblemDetails:
      type: object
      required:
        - type
        - title
        - status
      properties:
        type:
          type: string
          format: uri
          description: A URI reference identifying the problem type
          default: about:blank
        title:
          type: string
          description: A short, human-readable summary of the problem type
        status:
          type: integer
          format: int32
          description: >-
            The HTTP status code (informational only, actual code set by
            subtype)
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence
        instance:
          type: string
          format: uri
          description: A URI reference identifying the specific occurrence
        timestamp:
          type: string
          format: date-time
          description: Timestamp of the error
      description: RFC 7807 Problem Details for HTTP APIs
    Qyl.OTel.Enums.SeverityNumber:
      type: number
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
        - 7
        - 8
        - 9
        - 10
        - 11
        - 12
        - 13
        - 14
        - 15
        - 16
        - 17
        - 18
        - 19
        - 20
        - 21
        - 22
        - 23
        - 24
      description: Log severity number following OTel specification (1-24)
    Qyl.Common.TraceId:
      type: string
      minLength: 32
      maxLength: 32
      pattern: ^[a-f0-9]{32}$
      description: Unique trace identifier (32 lowercase hex characters)
      example: 0af7651916cd43dd8448eb211c80319c
      x-csharp-type: TraceId
      x-csharp-struct: true
      x-duckdb-type: VARCHAR(32)
    Qyl.Common.SpanId:
      type: string
      minLength: 16
      maxLength: 16
      pattern: ^[a-f0-9]{16}$
      description: Unique span identifier (16 lowercase hex characters)
      example: b7ad6b7169203331
      x-csharp-type: SpanId
      x-csharp-struct: true
      x-duckdb-type: VARCHAR(16)
    Qyl.Domains.Observe.Log.AttributeFilter:
      type: object
      required:
        - key
        - operator
        - value
      properties:
        key:
          type: string
          description: Attribute key
        operator:
          allOf:
            - $ref: '#/components/schemas/Qyl.Domains.Observe.Log.FilterOperator'
          description: Filter operator
        value:
          type: string
          description: Filter value
      description: Attribute filter
    Qyl.Domains.Observe.Log.LogOrderBy:
      type: string
      enum:
        - timestamp_asc
        - timestamp_desc
        - severity_asc
        - severity_desc
      description: Log ordering options
    Qyl.Domains.Observe.Log.AggregationFunction:
      type: string
      enum:
        - count
        - sum
        - avg
        - min
        - max
        - p50
        - p90
        - p95
        - p99
        - count_distinct
      description: Aggregation functions
    Qyl.Domains.Observe.Log.TimeBucket:
      type: string
      enum:
        - 1s
        - 10s
        - 30s
        - 1m
        - 5m
        - 15m
        - 30m
        - 1h
        - 6h
        - 12h
        - 1d
        - 1w
      description: Time bucket sizes
    Qyl.Domains.Observe.Log.FilterOperator:
      type: string
      enum:
        - eq
        - neq
        - contains
        - starts_with
        - ends_with
        - regex
        - gt
        - gte
        - lt
        - lte
        - in
        - not_in
        - exists
        - not_exists
      description: Filter operators

````