---
title: "Get surrounding log context"
method: POST
path: "/v3/logs/{id}/context"
tags: ["Logs"]
---

# Get surrounding log context

`POST /v3/logs/{id}/context`

Retrieve the matching log records immediately before and after an anchor log. Neighbors use the same free-text and structured filter dialect as SearchLogs and are returned in chronological order.

## Path parameters

- `id` string, required

## Request body

- GetLogContextRequest
  - `from` string, date-time, required
  - `to` string, date-time, required
  - `query` string
  - `filter_operator` string
  - `filters` TraceFilter[]
    - `field` string
    - `op` string
    - `values` string[]
  - `before` integer — Number of matching records earlier than the anchor. Defaults to 10.
  - `after` integer — Number of matching records later than the anchor. Defaults to 10.
  - `oql` string — Optional OQL pipeline. It cannot be combined with query or filters.

## Response `200`

OK

- GetLogContextResponse
  - `anchor` Log, required — Log is the canonical wire representation of an otel_logs row.
    - `id` string
    - `trace_id` string
    - `span_id` string
    - `timestamp` string, date-time
    - `observed_timestamp` string, date-time
    - `severity_number` integer
    - `severity_text` string
    - `body` string
    - `body_is_json` boolean
    - `event_name` string
    - `dropped_attributes_count` integer
    - `trace_flags` integer
    - `scope_name` string
    - `scope_version` string
    - `scope_attributes` object
    - `log_attributes` object
    - `resource_attributes` object
    - `service_name` string
    - `service_version` string
    - `deployment_environment` string
    - `host_name` string
    - `project_id` string
  - `before` Log[], required — Matching records earlier than the anchor, ordered oldest to newest.
    - `id` string
    - `trace_id` string
    - `span_id` string
    - `timestamp` string, date-time
    - `observed_timestamp` string, date-time
    - `severity_number` integer
    - `severity_text` string
    - `body` string
    - `body_is_json` boolean
    - `event_name` string
    - `dropped_attributes_count` integer
    - `trace_flags` integer
    - `scope_name` string
    - `scope_version` string
    - `scope_attributes` object
    - `log_attributes` object
    - `resource_attributes` object
    - `service_name` string
    - `service_version` string
    - `deployment_environment` string
    - `host_name` string
    - `project_id` string
  - `after` Log[], required — Matching records later than the anchor, ordered oldest to newest.
    - `id` string
    - `trace_id` string
    - `span_id` string
    - `timestamp` string, date-time
    - `observed_timestamp` string, date-time
    - `severity_number` integer
    - `severity_text` string
    - `body` string
    - `body_is_json` boolean
    - `event_name` string
    - `dropped_attributes_count` integer
    - `trace_flags` integer
    - `scope_name` string
    - `scope_version` string
    - `scope_attributes` object
    - `log_attributes` object
    - `resource_attributes` object
    - `service_name` string
    - `service_version` string
    - `deployment_environment` string
    - `host_name` string
    - `project_id` string
  - `has_more_before` boolean, required
  - `has_more_after` boolean, required

---

[API](https://skmtc.net/orq-ai/apis/orq-ai-api.md) · [All operations](https://skmtc.net/orq-ai/apis/orq-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/orq-ai/orq-ai-api/revisions/4fdc24e562eb/schema)
