Skip to main content

accounts_logs_explorer_datasets

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

Overview

Nameaccounts_logs_explorer_datasets
TypeResource
Idcloudflare.logs.accounts_logs_explorer_datasets

Fields

The following fields are returned by SELECT queries:

Dataset details, including the fields active for ingestion.

NameDatatypeDescription
dataset_idstringUnique dataset ID.
object_idstringPublic ID of the account or zone that owns this dataset.
created_atstring (date-time)RFC3339 timestamp recording when the API created this dataset.
datasetstringDataset type name (e.g. http_requests).
enabledbooleanWhether log ingest is currently active for this dataset.
fieldsarrayThe field configuration for this dataset.
object_typestringWhether this dataset belongs to an account or a zone. (account, zone)
updated_atstring (date-time)RFC3339 timestamp recording when the API last updated this dataset.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, dataset_idRetrieve a single Log Explorer dataset by ID for the account or zone.
listselectaccount_idinclude_zonesReturns all Log Explorer datasets configured for the account or zone. Pass include_zones=true to also include zone-level datasets that belong to this account or zone. List responses omit the fields property; use the single-dataset endpoint to retrieve field configuration.
post_accounts_account_id_logs_explorer_datasetsinsertaccount_id, datasetCreate a new Log Explorer dataset for the account or zone. Use the /account or zones/{account or zone_id}/logs/explorer/datasets/available endpoint to list dataset types you can create along with their available fields. The fields property is optional. If not specified, all available fields will be enabled.
put_accounts_account_id_logs_explorer_datasets_dataset_idreplaceaccount_id, dataset_id, enabledUpdates the enabled state and/or field configuration of an account or zone dataset.

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.
dataset_idstringThe dataset ID.
include_zonesbooleanSet to true to include zone-scoped datasets belonging to this account.

SELECT examples

Retrieve a single Log Explorer dataset by ID for the account or zone.

SELECT
dataset_id,
object_id,
created_at,
dataset,
enabled,
fields,
object_type,
updated_at
FROM cloudflare.logs.accounts_logs_explorer_datasets
WHERE account_id = '{{ account_id }}' -- required
AND dataset_id = '{{ dataset_id }}' -- required
;

INSERT examples

Create a new Log Explorer dataset for the account or zone. Use the /account or zones/{account or zone_id}/logs/explorer/datasets/available endpoint to list dataset types you can create along with their available fields. The fields property is optional. If not specified, all available fields will be enabled.

INSERT INTO cloudflare.logs.accounts_logs_explorer_datasets (
dataset,
fields,
account_id
)
SELECT
'{{ dataset }}' /* required */,
'{{ fields }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Updates the enabled state and/or field configuration of an account or zone dataset.

REPLACE cloudflare.logs.accounts_logs_explorer_datasets
SET
enabled = {{ enabled }},
fields = '{{ fields }}'
WHERE
account_id = '{{ account_id }}' --required
AND dataset_id = '{{ dataset_id }}' --required
AND enabled = {{ enabled }} --required
RETURNING
errors,
messages,
result,
success;