Skip to content
Start here

Get an account or zone dataset

logs.log_explorer.datasets.get(strdataset_id, DatasetGetParams**kwargs) -> Dataset
GET/{accounts_or_zones}/{account_or_zone_id}/logs/explorer/datasets/{dataset_id}

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

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Accepted Permissions (at least one required)
Logs Write
ParametersExpand Collapse
dataset_id: str
account_id: Optional[str]

The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.

zone_id: Optional[str]

The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.

ReturnsExpand Collapse
class Dataset:

A Log Explorer dataset summary. List endpoints return this type and omit field configuration; use the single-dataset endpoint to retrieve it.

created_at: datetime

RFC3339 timestamp recording when the API created this dataset.

formatdate-time
dataset: str

Dataset type name (e.g. http_requests).

dataset_id: str

Unique dataset ID.

enabled: bool

Whether log ingest is currently active for this dataset.

object_id: str

Public ID of the account or zone that owns this dataset.

object_type: Literal["account", "zone"]

Whether this dataset belongs to an account or a zone.

One of the following:
"account"
"zone"
updated_at: datetime

RFC3339 timestamp recording when the API last updated this dataset.

formatdate-time
fields: Optional[List[Field]]

The field configuration for this dataset.

enabled: bool

Whether the API includes this field in log ingest.

name: str

Field name in lowercase.

Get an account or zone dataset

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
dataset = client.logs.log_explorer.datasets.get(
    dataset_id="dataset_id",
    account_id="account_id",
)
print(dataset.dataset_id)
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "success": true,
  "result": {
    "created_at": "2019-12-27T18:11:19.117Z",
    "dataset": "dataset",
    "dataset_id": "dataset_id",
    "enabled": true,
    "object_id": "object_id",
    "object_type": "account",
    "updated_at": "2019-12-27T18:11:19.117Z",
    "fields": [
      {
        "enabled": true,
        "name": "name"
      }
    ]
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "success": true,
  "result": {
    "created_at": "2019-12-27T18:11:19.117Z",
    "dataset": "dataset",
    "dataset_id": "dataset_id",
    "enabled": true,
    "object_id": "object_id",
    "object_type": "account",
    "updated_at": "2019-12-27T18:11:19.117Z",
    "fields": [
      {
        "enabled": true,
        "name": "name"
      }
    ]
  }
}