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
Log Explorer enables you to store and explore your Cloudflare logs directly within the Cloudflare dashboard or API, giving you visibility into your logs without the need to forward them to third-party services. Logs are stored on Cloudflare's global network using the R2 object storage platform and can be queried via the dashboard or SQL API.
The key difference is that Log Explorer shows actual traffic, while Trace shows simulated "what-if" scenarios.
19
+
12
20
## Use Log Explorer
13
21
14
22
You can filter and view your logs via the Cloudflare dashboard or the API.
@@ -27,33 +35,32 @@ You can filter and view your logs via the Cloudflare dashboard or the API.
27
35
For example, to find an HTTP request with a specific [Ray ID](/fundamentals/reference/cloudflare-ray-id/), go to **Custom SQL**, and enter the following SQL query:
28
36
29
37
```sql
30
-
SELECT
31
-
clientRequestScheme,
32
-
clientRequestHost,
33
-
clientRequestMethod,
34
-
edgeResponseStatus,
35
-
clientRequestUserAgent
36
-
FROM http_requests
37
-
WHERE RayID ='806c30a3cec56817'
38
+
SELECT
39
+
clientRequestScheme,
40
+
clientRequestHost,
41
+
clientRequestMethod,
42
+
edgeResponseStatus,
43
+
clientRequestUserAgent
44
+
FROM http_requests
45
+
WHERE RayID ='806c30a3cec56817'
38
46
LIMIT1
39
47
```
40
48
41
-
42
49
As another example, to find Cloudflare Access requests with selected columns from a specific timeframe you could perform the following SQL query:
@@ -92,26 +99,26 @@ All the tables supported by Log Explorer contain a special column called `date`,
92
99
93
100
```sql
94
101
SELECT
95
-
clientip,
96
-
clientrequesthost,
97
-
clientrequestmethod,
98
-
clientrequesturi,
99
-
edgeendtimestamp,
100
-
edgeresponsestatus,
101
-
originresponsestatus,
102
-
edgestarttimestamp,
103
-
rayid,
104
-
clientcountry,
105
-
clientrequestpath,
102
+
clientip,
103
+
clientrequesthost,
104
+
clientrequestmethod,
105
+
clientrequesturi,
106
+
edgeendtimestamp,
107
+
edgeresponsestatus,
108
+
originresponsestatus,
109
+
edgestarttimestamp,
110
+
rayid,
111
+
clientcountry,
112
+
clientrequestpath,
106
113
date
107
-
FROM
114
+
FROM
108
115
http_requests
109
-
WHERE
116
+
WHERE
110
117
date='2023-10-12'LIMIT500
111
118
```
112
119
113
120
### Additional query optimization tips
114
121
115
122
- Narrow your query time frame. Focus on a smaller time window to reduce the volume of data processed. This helps avoid querying excessive amounts of data and speeds up response times.
116
123
- Omit `ORDER BY` and `LIMIT` clauses. These clauses can slow down queries, especially when dealing with large datasets. For queries that return a large number of records, reduce the time frame instead of limiting to the newest `N` records from a broader time frame.
117
-
- Select only necessary columns. For example, replace `SELECT *` with the list of specific columns you need. You can also use `SELECT RayId` as a first iteration and follow up with a query that filters by the Ray IDs to retrieve additional columns. Additionally, you can use `SELECT COUNT(*)` to probe for time frames with matching records without retrieving the full dataset.
124
+
- Select only necessary columns. For example, replace `SELECT *` with the list of specific columns you need. You can also use `SELECT RayId` as a first iteration and follow up with a query that filters by the Ray IDs to retrieve additional columns. Additionally, you can use `SELECT COUNT(*)` to probe for time frames with matching records without retrieving the full dataset.
Use {props.addLink? <ahref="/log-explorer/">Log Explorer</a> :"Log Explorer"} when you need to investigate what actually happened with real production traffic:
7
+
8
+
- Analyzing historical data and trends
9
+
- Investigating security incidents after they occur
10
+
- Searching for patterns across thousands of requests
0 commit comments