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

# Get Observability Logs

> Per-job log lines for one agent or KB.

Replaces the namespace-scoped kubectl tail with a per-``job_name``
ClickHouse query. ``agent_id`` resolves to the prefix
``agent_<id>_`` or ``kb_<id>_`` via the doc's ``job_type``; the
prefix LIKE catches every redeploy version of the entity so log
history survives re-deploys.

Returns 404 when the id doesn't belong to this tenant + service (or
the doc's ``job_type`` isn't agent / KB). Returns 503 with a
structured ``kind`` when the ``flink_logs`` table is missing or
a column has drifted.



## OpenAPI

````yaml /openapi/openapi.json get /agentic/observability/logs
openapi: 3.1.0
info:
  title: Streamkap REST API
  description: >-
    The Streamkap REST API allows you to programmatically manage your CDC
    pipelines, sources, destinations, transforms, and more.


    Authenticate using a bearer token obtained from the [Access
    Token](/api-reference/auth/access-token) endpoint with your API client
    credentials.
  contact:
    name: Streamkap Support
    url: https://streamkap.com/
    email: support@streamkap.com
  license:
    name: Proprietary
  version: 2.0.0
servers:
  - url: https://api.streamkap.com
    description: Production
security: []
tags:
  - name: Agents
    description: Create, deploy, and manage Flink-based AI agents.
  - name: Agents Observability
    description: >-
      Read-only views over the MCP audit log: agent rollup, sessions, spans,
      histograms, external-agent verify.
  - name: Alerts
    description: Manage alert subscribers, preferences, and notification credentials.
  - name: Authentication
    description: Obtain and refresh access tokens, manage client credentials and roles.
  - name: Billing
    description: Retrieve usage metrics, summaries, and export billing data.
  - name: Consumer Groups
    description: List, inspect, and reset Kafka consumer group offsets.
  - name: Dashboard
    description: Retrieve organisation-level statistics and overview data.
  - name: Destinations
    description: Create, configure, and manage data destinations and their lifecycle.
  - name: Kafka Access
    description: Manage Kafka users and their access permissions.
  - name: Logs
    description: Query and summarise system logs.
  - name: Pipelines
    description: Create, configure, and manage CDC pipelines and their lifecycle.
  - name: Project Keys
    description: Manage project keys that bundle API credentials and optional Kafka access.
  - name: Schema Registry
    description: Browse schema subjects, versions, and retrieve schema definitions.
  - name: Services
    description: View and switch service metadata.
  - name: Sources
    description: >-
      Create, configure, and manage data sources, snapshots, and their
      lifecycle.
  - name: Tags
    description: Create, update, and manage resource tags for organisation.
  - name: Topics
    description: Browse topic details, statistics, configurations, metrics, and messages.
  - name: Transforms
    description: >-
      Create, deploy, and manage data transforms, unit tests, and implementation
      details.
paths:
  /agentic/observability/logs:
    get:
      tags:
        - Agents Observability
      summary: Get Observability Logs
      description: |-
        Per-job log lines for one agent or KB.

        Replaces the namespace-scoped kubectl tail with a per-``job_name``
        ClickHouse query. ``agent_id`` resolves to the prefix
        ``agent_<id>_`` or ``kb_<id>_`` via the doc's ``job_type``; the
        prefix LIKE catches every redeploy version of the entity so log
        history survives re-deploys.

        Returns 404 when the id doesn't belong to this tenant + service (or
        the doc's ``job_type`` isn't agent / KB). Returns 503 with a
        structured ``kind`` when the ``flink_logs`` table is missing or
        a column has drifted.
      operationId: getAgenticObservabilityLogs
      parameters:
        - name: agent_id
          in: query
          required: true
          schema:
            type: string
            description: Agent or knowledge base id (Mongo ObjectId)
            title: Agent Id
          description: Agent or knowledge base id (Mongo ObjectId)
        - name: from
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Time range start (ISO 8601)
            title: From
          description: Time range start (ISO 8601)
        - name: to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Time range end (ISO 8601)
            title: To
          description: Time range end (ISO 8601)
        - name: level
          in: query
          required: false
          schema:
            type: string
            description: >-
              Floor level — DEBUG | INFO | WARN | ERROR (used when `levels` is
              absent)
            default: INFO
            title: Level
          description: >-
            Floor level — DEBUG | INFO | WARN | ERROR (used when `levels` is
            absent)
        - name: levels
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Explicit comma-separated level set (e.g. 'WARN,ERROR'). Overrides
              the `level` floor when present.
            title: Levels
          description: >-
            Explicit comma-separated level set (e.g. 'WARN,ERROR'). Overrides
            the `level` floor when present.
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Substring filter on the log column
            title: Search
          description: Substring filter on the log column
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 2000
            minimum: 1
            description: Max lines per call
            default: 200
            title: Limit
          description: Max lines per call
        - name: since
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Live-tail cursor — only rows newer than this ISO 8601 ts
            title: Since
          description: Live-tail cursor — only rows newer than this ISO 8601 ts
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ObservabilityLogsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - FronteggHTTPAuthentication: []
components:
  schemas:
    ObservabilityLogsResponse:
      properties:
        lines:
          items:
            $ref: '#/components/schemas/ObservabilityLogLine'
          type: array
          title: Lines
        scope:
          type: string
          const: agent
          title: Scope
          default: agent
        job_id_prefix:
          type: string
          title: Job Id Prefix
      additionalProperties: false
      type: object
      required:
        - lines
        - job_id_prefix
      title: ObservabilityLogsResponse
      description: |-
        `/agentic/observability/logs` response envelope.

        ``scope`` always ``"agent"`` on this endpoint — per-job filtering
        is real (the ``job_id`` prefix LIKE catches only this entity's
        history). The kubectl-tail path's ``"namespace"`` value disappears
        here. ``job_id_prefix`` is echoed back so the FE can render
        "N versions" hints when a redeployed agent's history is mixed in.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ObservabilityLogLine:
      properties:
        timestamp:
          type: string
          title: Timestamp
        level:
          type: string
          title: Level
        message:
          type: string
          title: Message
      additionalProperties: false
      type: object
      required:
        - timestamp
        - level
        - message
      title: ObservabilityLogLine
      description: |-
        One log line for the per-job log viewer.

        ``timestamp`` is intentionally a string (not ``datetime``) so the wire
        shape matches the kubectl-path ``AgentLogLine`` byte-for-byte — the FE
        renders it verbatim and doesn't parse it as a date. Format is
        ClickHouse's default ``"YYYY-MM-DD HH:MM:SS,sss"``.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    FronteggHTTPAuthentication:
      type: http
      scheme: bearer

````