# LogService

**Spinbox is experimental: APIs change and data may be lost.** What is built and what proves it is on [Status](https://spin-stack.github.io/website/reference/status.md); what Spinbox does not do is on [Limitations](https://spin-stack.github.io/website/overview/limitations.md).

> spin.v1.LogService: each procedure, its request and its response.

<!-- Generated by tools/refgen from spin:internal/controlplane/apidocs/spin.v1.openapi.json. Edit the source, not this file. -->

LogService is what the installation logged, as its store of logs and traces keeps it. (internal/logstore). Every search is confined by the control plane to what the caller may see; what the caller types is searched inside that and cannot widen it.

## GetTrace

`POST /spin.v1.LogService/GetTrace`

GetTrace is every span of one trace, in the order they began.

**Request**

| Field | Type | What it is |
|---|---|---|
| `traceId` | string | Hex, as a log record carries it. |

**Response**

| Field | Type | What it is |
|---|---|---|
| `spans` | list of [Span](https://spin-stack.github.io/website/reference/api/types.md#span) |  |

## HistogramPlatformLogs

`POST /spin.v1.LogService/HistogramPlatformLogs`

HistogramPlatformLogs is how many of those records each interval of the window holds, by severity: the chart above them.

**Request**

| Field | Type | What it is |
|---|---|---|
| `query` | string |  |
| `from` | `Timestamp` |  |
| `to` | `Timestamp` |  |
| `intervals` | integer (int32) | How many intervals to split the window into: 1 to 200, 60 when unset. Each is at least a second. |

**Response**

| Field | Type | What it is |
|---|---|---|
| `intervals` | list of [LogInterval](https://spin-stack.github.io/website/reference/api/types.md#loginterval) |  |

## HistogramWorkspaceLogs

`POST /spin.v1.LogService/HistogramWorkspaceLogs`

HistogramWorkspaceLogs is how many of those records each interval of the window holds.

**Request**

| Field | Type | What it is |
|---|---|---|
| `workspaceId` | string |  |
| `query` | string |  |
| `from` | `Timestamp` |  |
| `to` | `Timestamp` |  |
| `intervals` | integer (int32) |  |

**Response**

| Field | Type | What it is |
|---|---|---|
| `intervals` | list of [LogInterval](https://spin-stack.github.io/website/reference/api/types.md#loginterval) |  |

## ListLogIndexes

`POST /spin.v1.LogService/ListLogIndexes`

ListLogIndexes is every index the store keeps, as the store itself reports it: its fields, how long it keeps what it holds and how much it holds. An administrator's: how much each index holds is how busy the installation and its workspaces are.

**Request**

No fields: `{}`.

**Response**

| Field | Type | What it is |
|---|---|---|
| `indexes` | list of [LogIndex](https://spin-stack.github.io/website/reference/api/types.md#logindex) |  |

## PlatformLogFieldValues

`POST /spin.v1.LogService/PlatformLogFieldValues`

PlatformLogFieldValues is what one field most often is in the records a search of the platform's logs finds: service_name, severity_text, attributes.\* or resource_attributes.\*.

**Request**

| Field | Type | What it is |
|---|---|---|
| `field` | string |  |
| `query` | string |  |
| `from` | `Timestamp` |  |
| `to` | `Timestamp` |  |
| `limit` | integer (int32) | How many values, the commonest first: 1 to 100, 10 when unset. |

**Response**

| Field | Type | What it is |
|---|---|---|
| `values` | list of [FieldValue](https://spin-stack.github.io/website/reference/api/types.md#fieldvalue) |  |
| `other` | string (int64) | How many records the search found with a value not among these. |

## SearchPlatformLogs

`POST /spin.v1.LogService/SearchPlatformLogs`

SearchPlatformLogs is what the installation's own processes logged - the control plane, the proxy, the runners. An administrator's: a platform's log names every workspace it touched.

**Request**

| Field | Type | What it is |
|---|---|---|
| `query` | string | Quickwit's query language (https://quickwit.io/docs/reference/query-language). Empty is every record in the window. |
| `from` | `Timestamp` | The window, both ends included. Unset `to` is now; unset `from` is an hour before `to`. |
| `to` | `Timestamp` |  |
| `limit` | integer (int32) | How many records: 1 to 1000, 100 when unset. |
| `offset` | integer (int32) | How many to skip from the first: the page after the first. With limit, at most 10000. |
| `oldestFirst` | boolean | The oldest first rather than the newest: the window read as it happened. |

**Response**

| Field | Type | What it is |
|---|---|---|
| `records` | list of [LogRecord](https://spin-stack.github.io/website/reference/api/types.md#logrecord) |  |
| `total` | string (int64) | How many records the window holds that match, of which `records` is the newest `limit`. |

## SearchTraces

`POST /spin.v1.LogService/SearchTraces`

SearchTraces is the installation's traces whose first span matches, newest first. An administrator's, as the platform's logs are.

**Request**

| Field | Type | What it is |
|---|---|---|
| `query` | string | Quickwit's query language, over each trace's first span: service_name, span_name, span_attributes.\*, span_status.code. Empty is every trace in the window. |
| `from` | `Timestamp` |  |
| `to` | `Timestamp` |  |
| `limit` | integer (int32) | 1 to 1000, 100 when unset. |
| `anySpan` | boolean | Search every span rather than each trace's first: a workspace's creation is the control plane's span inside a trace the browser began, and span_name or span_attributes.spin.workspace_id finds it only among all of them. Each span found is listed, and opens its whole trace. |
| `offset` | integer (int32) | As SearchPlatformLogsRequest's. |

**Response**

| Field | Type | What it is |
|---|---|---|
| `roots` | list of [Span](https://spin-stack.github.io/website/reference/api/types.md#span) |  |
| `total` | string (int64) |  |

## SearchWorkspaceLogs

`POST /spin.v1.LogService/SearchWorkspaceLogs`

SearchWorkspaceLogs is what one workspace's machine wrote to its console, where the installation collects it: whoever may read the workspace's console may search it.

**Request**

| Field | Type | What it is |
|---|---|---|
| `workspaceId` | string |  |
| `query` | string | As SearchPlatformLogsRequest's: searched inside the workspace, never beyond it. |
| `from` | `Timestamp` |  |
| `to` | `Timestamp` |  |
| `limit` | integer (int32) |  |
| `offset` | integer (int32) | As SearchPlatformLogsRequest's. |
| `oldestFirst` | boolean | As SearchPlatformLogsRequest's. |

**Response**

| Field | Type | What it is |
|---|---|---|
| `records` | list of [LogRecord](https://spin-stack.github.io/website/reference/api/types.md#logrecord) |  |
| `total` | string (int64) |  |

## ServiceHealth

`POST /spin.v1.LogService/ServiceHealth`

ServiceHealth is how each of the installation's services did over a window, as its traces and logs say it. An administrator's, as the traces are.

**Request**

| Field | Type | What it is |
|---|---|---|
| `from` | `Timestamp` |  |
| `to` | `Timestamp` |  |
| `intervals` | integer (int32) | As HistogramPlatformLogsRequest's. |

**Response**

| Field | Type | What it is |
|---|---|---|
| `services` | list of [ServiceHealth](https://spin-stack.github.io/website/reference/api/types.md#servicehealth) |  |

## WorkspaceLogFieldValues

`POST /spin.v1.LogService/WorkspaceLogFieldValues`

WorkspaceLogFieldValues is the same of one workspace's, for whoever may read it.

**Request**

| Field | Type | What it is |
|---|---|---|
| `workspaceId` | string |  |
| `field` | string |  |
| `query` | string |  |
| `from` | `Timestamp` |  |
| `to` | `Timestamp` |  |
| `limit` | integer (int32) |  |

**Response**

| Field | Type | What it is |
|---|---|---|
| `values` | list of [FieldValue](https://spin-stack.github.io/website/reference/api/types.md#fieldvalue) |  |
| `other` | string (int64) |  |
