Return severity counts grouped by time buckets at a configurable grain (auto, minute, hour, day).
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.aggregate()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
from_ |
date |
➖ |
N/A |
to |
date |
➖ |
N/A |
grain |
Optional[str] |
➖ |
Time bucket grain: "auto" | "minute" | "hour" | "day". "auto" picks the grain from the requested time range. Empty returns rows without time buckets. |
filters |
List[models.TraceFilter] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.AggregateLogsResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Return the facet hierarchy: attribute families (native, attribute, resource, scope) with their keys, counts, and top values. Accepts optional filters and free-text query to narrow the counted subset.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.list_facets()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
from_ |
date |
➖ |
N/A |
to |
date |
➖ |
N/A |
key_limit |
Optional[int] |
➖ |
N/A |
value_limit |
Optional[int] |
➖ |
N/A |
query |
Optional[str] |
➖ |
N/A |
filter_operator |
Optional[str] |
➖ |
N/A |
filters |
List[models.TraceFilter] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.ListLogFacetsResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Return distinct values with occurrence counts for a given facet field.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.list_facet_values(field="<value>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
field |
str |
✔️ |
N/A |
limit |
Optional[int] |
➖ |
N/A |
from_ |
date |
➖ |
N/A |
to |
date |
➖ |
N/A |
search |
Optional[str] |
➖ |
Optional case-insensitive substring search over facet values. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.ListLogFacetValuesResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Return all queryable fields: static columns and dynamic attribute families (attribute., resource.).
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.list_fields()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.ListLogFieldsResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Find stable templates in a bounded sample of matching log bodies. The response reports sampling and truncation metadata and never returns an unbounded list of raw bodies.
from orq_ai_sdk import Orq
from orq_ai_sdk.utils import parse_datetime
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.find_patterns(from_=parse_datetime("2025-09-21T07:55:29.692Z"), to=parse_datetime("2024-10-05T00:49:57.596Z"))
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
from_ |
date |
✔️ |
N/A |
to |
date |
✔️ |
N/A |
query |
Optional[str] |
➖ |
N/A |
filter_operator |
Optional[str] |
➖ |
N/A |
filters |
List[models.TraceFilter] |
➖ |
N/A |
limit |
Optional[int] |
➖ |
Maximum patterns to return. Defaults to 50. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.FindLogPatternsResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Run an OQL log query using the pipeline grammar fetch logs | filter <expr> | sort timestamp desc | limit N. The query is compiled onto the same engine as SearchLogs; timestamp desc is the only supported sort.
from orq_ai_sdk import Orq
from orq_ai_sdk.utils import parse_datetime
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.query(oql="<value>", from_=parse_datetime("2026-04-01T20:23:07.108Z"), to=parse_datetime("2025-08-17T16:51:30.424Z"))
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
oql |
str |
✔️ |
OQL query string, e.g. fetch logs | filter severity_number > 10 | filter body contains "error". |
from_ |
date |
✔️ |
N/A |
to |
date |
✔️ |
N/A |
limit |
Optional[int] |
➖ |
Maximum rows to return; a | limit N pipeline command takes precedence. |
page_token |
Optional[str] |
➖ |
Opaque cursor for pagination. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.QueryLogsResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Query log records with filters, free-text search, and keyset pagination. Results are ordered timestamp desc (the only supported sort, mirroring traces).
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.search()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
from_ |
date |
➖ |
N/A |
to |
date |
➖ |
N/A |
query |
Optional[str] |
➖ |
Free-text query matched against the body field (case-insensitive). |
filter_operator |
Optional[str] |
➖ |
How to combine multiple filters: "and" (default) or "or", mirroring the traces filter_operator. |
filters |
List[models.TraceFilter] |
➖ |
N/A |
sort |
List[models.TraceSort] |
➖ |
N/A |
limit |
Optional[int] |
➖ |
Maximum rows to return. Defaults to 100 and is capped at 1000. |
page_token |
Optional[str] |
➖ |
Opaque cursor for pagination; empty or absent means the first page. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.SearchLogsResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Retrieve a log record by its ULID. Returns 404 if the record does not exist or belongs to another workspace.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.get(id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetLogResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
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.
from orq_ai_sdk import Orq
from orq_ai_sdk.utils import parse_datetime
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.context(id="<id>", from_=parse_datetime("2025-10-13T07:44:36.992Z"), to=parse_datetime("2025-04-02T17:30:56.013Z"))
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
N/A |
from_ |
date |
✔️ |
N/A |
to |
date |
✔️ |
N/A |
query |
Optional[str] |
➖ |
N/A |
filter_operator |
Optional[str] |
➖ |
N/A |
filters |
List[models.TraceFilter] |
➖ |
N/A |
before |
Optional[int] |
➖ |
Number of matching records earlier than the anchor. Defaults to 10. |
after |
Optional[int] |
➖ |
Number of matching records later than the anchor. Defaults to 10. |
oql |
Optional[str] |
➖ |
Optional OQL pipeline. It cannot be combined with query or filters. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.GetLogContextResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |
Return all log records correlated with a given trace_id. Results are scoped to the authenticated workspace.
from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.logs.list_trace_logs(trace_id="<id>")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
trace_id |
str |
✔️ |
N/A |
limit |
Optional[int] |
➖ |
N/A |
page_token |
Optional[str] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.ListTraceLogsResponse
| Error Type |
Status Code |
Content Type |
| models.APIDefaultError |
4XX, 5XX |
*/* |