# REST-API: Logs

> Die 6 Operationen des Bereichs Logs, mit Parametern, Bodys und Antworten.

Source: https://pithyx.org/de/docs/reference/api/logs/
Markdown: https://pithyx.org/de/docs/reference/api/logs.md

Erzeugt aus dem OpenAPI-Dokument des Daemons. Konventionen, Anmeldung, der CSRF-Header und der WebSocket stehen unter [API](https://pithyx.org/de/docs/developers/daemon/api/).

## POST /api/apps/{app}/logs

Stores log entries a core app wrote through the SDK for the signed-in user, as source app/<app>; only for a core app the user may open (auth.permission.denied otherwise; third-party apps write through /api/app/logs). Debug entries are left out. At most 100 entries per request; each app may write bursts of 200 and then 20 entries a second, the rest is dropped and counted.

**Parameter**

| Name  | Ort  | Typ    | Pflicht | Beschreibung |
| ----- | ---- | ------ | ------- | ------------ |
| `app` | path | string | ja      |              |

**Anfrage-Body**: `application/json`: [AppLogBatch](https://pithyx.org/de/docs/reference/api/schemas/#applogbatch)

**Antworten**

- 200: `application/json`: [AppLogResult](https://pithyx.org/de/docs/reference/api/schemas/#applogresult)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## GET /api/logs

Administrators only. Log entries of the daemon, the system services and the apps, newest first, from the current logs and the archive together. Filters: time range (from, to), level (repeat for several: debug, info, warn, error), source (repeat for several), search (text in the message or its fields, or an exact request id). Pass nextCursor as cursor for older entries; limit is 1 to 1000 (default 200).

**Parameter**

| Name     | Ort   | Typ                | Pflicht | Beschreibung |
| -------- | ----- | ------------------ | ------- | ------------ |
| `from`   | query | string (date-time) | nein    |              |
| `to`     | query | string (date-time) | nein    |              |
| `level`  | query | string[]           | nein    |              |
| `source` | query | string[]           | nein    |              |
| `search` | query | string             | nein    |              |
| `cursor` | query | string             | nein    |              |
| `limit`  | query | integer (int32)    | nein    |              |

**Antworten**

- 200: `application/json`: [LogPage](https://pithyx.org/de/docs/reference/api/schemas/#logpage)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## GET /api/logs/export

Administrators only. Every entry matching the same filters as GET /api/logs, newest first, as a download: JSON lines, or text lines with format=text. At most 1,000,000 entries.

**Parameter**

| Name     | Ort   | Typ                | Pflicht | Beschreibung |
| -------- | ----- | ------------------ | ------- | ------------ |
| `from`   | query | string (date-time) | nein    |              |
| `to`     | query | string (date-time) | nein    |              |
| `level`  | query | string[]           | nein    |              |
| `source` | query | string[]           | nein    |              |
| `search` | query | string             | nein    |              |
| `format` | query | string             | nein    |              |

**Antworten**

- 200

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## GET /api/logs/settings

Administrators only. The retention of the current logs and of the archive, with the space they take, their oldest entries and the pools that can hold the archive.

**Antworten**

- 200: `application/json`: [LogStatus](https://pithyx.org/de/docs/reference/api/schemas/#logstatus)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## PUT /api/logs/settings

Administrators only. Sets the retention. The current logs (system and apps together) stay below maxBytes, at most 4 GB; entries older than retentionDays go. The archive on a pool is optional; archivePool null means the first pool.

**Anfrage-Body**: `application/json`: [LogSettings](https://pithyx.org/de/docs/reference/api/schemas/#logsettings)

**Antworten**

- 200: `application/json`: [LogStatus](https://pithyx.org/de/docs/reference/api/schemas/#logstatus)

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).

## GET /api/logs/sources

Administrators only. Every source with entries in the current logs or the archive: daemon, system/<service>, app/<id>.

**Antworten**

- 200: `application/json`: string[]

Jeder Fehler antwortet mit Problem Details (`application/problem+json`) und einem stabilen Code aus der [Fehlerreferenz](https://pithyx.org/de/docs/reference/errors/).
