You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to communicate with the API, you will need to configure the appropriate authentication headers.
38
+
Log Explorer is available to users with the following permissions:
39
+
40
+
-**Logs Edit**: users with Logs Edit permissions can enable datasets.
41
+
-**Logs Read**: users with Logs Read permissions can run queries via the UI or API.
42
+
43
+
Note that these permissions exist at the account and zone level and you need the appropriate permission level for the datasets you wish to query.
44
+
45
+
Authentication with the API can be done via an authentication header or API token. Append your API call with either of the following additional parameters.
30
46
31
-
-`X-Auth-Email` - the Cloudflare account email address associated with the domain
32
-
-`X-Auth-Key` - the Cloudflare API key
47
+
-**Authentication header**
33
48
34
-
Alternatively, API tokens with Account and Zone level Logs Edit permissions can also be used for authentication:
49
+
-`X-Auth-Email` - the Cloudflare account email address associated with the domain
50
+
-`X-Auth-Key` - the Cloudflare API key
35
51
36
-
-`Authorization: Bearer <API_TOKEN>`
52
+
-**API token**
53
+
54
+
-`Authorization: Bearer <API_TOKEN>` To create an appropriately scoped API token, refer to [Create API token](/fundamentals/api/get-started/create-token/) documentation. Copy and paste the token into the authorization parameter for your API call.
55
+
56
+
37
57
38
58
## Enable Log Explorer
39
59
40
-
You can use the dashboard or the API to enable the datasets you want to query with Log Explorer.
60
+
In order for Log Explorer to begin storing logs, you need to enable the desired datasets. You can do this via the dashboard or the API.
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain.
64
+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account or domain (also known as zone).
45
65
2. Go to **Analytics & Logs** > **Log Explorer**.
46
66
3. Select **Enable a dataset** to select the datasets you want to query. You can enable more datasets later.
47
67
@@ -52,9 +72,9 @@ It may take a few minutes for the logs to become available for querying.
52
72
53
73
</TabItem> <TabItemlabel="API">
54
74
55
-
Use the Log Explorer API to enable Log Explorer for each dataset you wish to store. It may take up to 30 minutes after a logstream is enabled before you can view the logs.
75
+
Use the Log Explorer API to enable Log Explorer for each dataset you wish to store. It may take a few minutes after a log stream is enabled before you can view the logs.
56
76
57
-
The following curl command is an example for enabling `http_requests`, as well as the expected response when the command succeeds.
77
+
The following curl command is an example for enabling the zone-level dataset `http_requests`, as well as the expected response when the command succeeds.
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account and domain.
121
+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account or domain (also known as zone).
91
122
2. Go to **Analytics & Logs** > **Log Explorer**.
92
123
3. From the dropdown, select the **Dataset** you want to use.
93
124
4. Select a **Limit**. That is the maximum number of results to return, for example, 50.
@@ -133,6 +164,38 @@ Which returns the following HTTP request details:
133
164
}
134
165
```
135
166
167
+
For another example using an account-level dataset, to find Cloudflare Access requests with selected columns from a specific timeframe, you can perform the following SQL query.
--url-query query="SELECT CreatedAt, AppDomain, AppUUID, Action, Allowed, Country, RayID, Email, IPAddress, UserUID FROM access_requests WHERE Date >= '2025-02-06' AND Date <= '2025-02-06' AND CreatedAt >= '2025-02-06T12:28:39Z' AND CreatedAt <= '2025-02-06T12:58:39Z'"
@@ -214,6 +277,10 @@ Log Explorer performs best when query parameters focus on narrower ranges of tim
214
277
215
278
If your query times out with an HTTP status of 524 (Gateway Timeout), consider using one of the [streaming output formats](/logs/log-explorer/#output-formats), such as `application/x-ndjson`.
216
279
280
+
### Why don't I see any logs in my queries after enabling the dataset?
281
+
282
+
Log Explorer starts ingesting logs from the moment you enable the dataset. It will not display logs for events that occurred before the dataset was enabled. Make sure that new events have been generated since enabling the dataset, and check again.
283
+
217
284
### My query returned an error. How do I figure out what went wrong?
218
285
219
286
We are actively working on improving error codes. If you receive a generic error, check your SQL syntax (if you are using the custom SQL feature), make sure you have included a date and a limit, and that the field you are filtering is not a key-value pair. If the query still fails it is likely timing out. Try refining your filters.
0 commit comments