Skip to main content

tail

Creates, updates, deletes, gets or lists a tail resource.

Overview

Nametail
TypeResource
Idcloudflare.workers.tail

Fields

The following fields are returned by SELECT queries:

List Tails response.

NameDatatypeDescription
idstringIdentifier. (example: 023e105f4ecef8ad9ca31a8372d0c353)
expires_atstring
urlstring

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectaccount_id, script_nameGet list of tails currently deployed on a Worker.
createinsertaccount_id, script_nameStarts a tail that receives logs and exception from a Worker.
deletedeleteaccount_id, script_name, idDeletes a tail from a Worker.

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
account_idstringThe Cloudflare account ID.
idstringResource ID.
script_namestringThe Worker script name.

SELECT examples

Get list of tails currently deployed on a Worker.

SELECT
id,
expires_at,
url
FROM cloudflare.workers.tail
WHERE account_id = '{{ account_id }}' -- required
AND script_name = '{{ script_name }}' -- required
;

INSERT examples

Starts a tail that receives logs and exception from a Worker.

INSERT INTO cloudflare.workers.tail (
account_id,
script_name
)
SELECT
'{{ account_id }}',
'{{ script_name }}'
RETURNING
errors,
messages,
result,
success
;

DELETE examples

Deletes a tail from a Worker.

DELETE FROM cloudflare.workers.tail
WHERE account_id = '{{ account_id }}' --required
AND script_name = '{{ script_name }}' --required
AND id = '{{ id }}' --required
;