Skip to main content

app_logs

Creates, updates, deletes, gets or lists an app_logs resource.

Overview

Nameapp_logs
TypeResource
Iddeno.deployment.app_logs

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
levelstring
messagestring (example: log message)
regionstring
timestring (date-time)Log timestamp (example: 2021-08-01T00:00:00Z)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_app_logsselectdeploymentIdq, level, region, since, until, limit, sort, order, cursorThis 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; if
application/x-ndjson is specified, the response will be a stream of
newline-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.

NameDatatypeDescription
deploymentIdstringDeployment ID
cursorstringOpaque value that represents the cursor of the last log returned in the previous request. This is only effective for the past log mode.
levelstringLog 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)
limitintegerMaximum number of logs to return in one request. This is only effective for the past log mode.
orderstringSort 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.
qstringText to search for in log message. (example: foobar)
regionstringRegion(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)
sincestring (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)
sortstringThe field to sort by. Currently only time is supported. This is only effective for the past log mode.
untilstring (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

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; if
application/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 }}'
;