app_logs
Creates, updates, deletes, gets or lists an app_logs resource.
Overview
| Name | app_logs |
| Type | Resource |
| Id | deno.deployment.app_logs |
Fields
The following fields are returned by SELECT queries:
- get_app_logs
| Name | Datatype | Description |
|---|---|---|
level | string | |
message | string | (example: log message) |
region | string | |
time | string (date-time) | Log timestamp (example: 2021-08-01T00:00:00Z) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_app_logs | select | deploymentId | q, level, region, since, until, limit, sort, order, cursor | This API can return either past logs or real-time logs depending on the presence of the since and until query parameters; if at least one of them is provided, past logs are returned, otherwise real-time logs are returned. Also, the response format can be controlled by the Accept header; ifapplication/x-ndjson is specified, the response will be a stream ofnewline-delimited JSON objects. Otherwise it will be a JSON array of objects. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
deploymentId | string | Deployment ID |
cursor | string | Opaque value that represents the cursor of the last log returned in the previous request. This is only effective for the past log mode. |
level | string | Log level(s) to filter logs by. Defaults to all levels (i.e. no filter applied). Multiple levels can be specified using comma-separated format. (example: error,warning) |
limit | integer | Maximum number of logs to return in one request. This is only effective for the past log mode. |
order | string | Sort order, either asc or desc. Defaults to desc. For backward compatibility, timeAsc and timeDesc are also supported, but deprecated. This is only effective for the past log mode. |
q | string | Text to search for in log message. (example: foobar) |
region | string | Region(s) to filter logs by. Defaults to all regions (i.e. no filter applied). Multiple regions can be specified using comma-separated format. (example: gcp-us-central1,gcp-us-east1) |
since | string (date-time) | Start time of the time range to filter logs by. Defaults to the Unix Epoch (though the log retention period is 2 weeks as of now). If neither since nor until is specified, real-time logs are returned. (example: 2021-08-01T00:00:00Z) |
sort | string | The field to sort by. Currently only time is supported. This is only effective for the past log mode. |
until | string (date-time) | End time of the time range to filter logs by. Defaults to the current time. If neither since nor until is specified, real-time logs are returned. (example: 2021-08-01T00:00:00Z) |
SELECT examples
- get_app_logs
This API can return either past logs or real-time logs depending on the
presence of the since and until query parameters; if at least one of them
is provided, past logs are returned, otherwise real-time logs are returned.
Also, the response format can be controlled by the Accept header; ifapplication/x-ndjson is specified, the response will be a stream of
newline-delimited JSON objects. Otherwise it will be a JSON array of
objects.
SELECT
level,
message,
region,
time
FROM deno.deployment.app_logs
WHERE deploymentId = '{{ deploymentId }}' -- required
AND q = '{{ q }}'
AND level = '{{ level }}'
AND region = '{{ region }}'
AND since = '{{ since }}'
AND until = '{{ until }}'
AND limit = '{{ limit }}'
AND sort = '{{ sort }}'
AND order = '{{ order }}'
AND cursor = '{{ cursor }}'
;