Skip to content

Commit 88d3e47

Browse files
committed
update docs for R2 Account level and User level API tokens
1 parent 2422c65 commit 88d3e47

File tree

14 files changed

+259
-271
lines changed

14 files changed

+259
-271
lines changed

public/__redirects

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,8 @@
11871187

11881188
# r2
11891189
/r2/platform/s3-compatibility/api/ /r2/api/s3/api/ 301
1190-
/r2/platform/s3-compatibility/tokens/ /r2/api/s3/tokens/ 301
1190+
/r2/platform/s3-compatibility/tokens/ /r2/api/tokens/ 301
1191+
/r2/api/s3/tokens/ /r2/api/tokens/ 301
11911192
/r2/runtime-apis/ /r2/api/workers/workers-api-reference/ 301
11921193
/r2/data-access/ /r2/api/ 301
11931194
/r2/data-access/public-buckets/ /r2/buckets/public-buckets/ 301

src/content/docs/data-localization/how-to/r2.mdx

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ title: R2 Object Storage
33
pcx_content_type: how-to
44
sidebar:
55
order: 6
6-
76
---
87

9-
import { Details } from "~/components"
8+
import { Details } from "~/components";
109

1110
In the following sections, we will give you some details about how to configure R2 with Regional Services and Customer Metadata Boundary.
1211

@@ -32,7 +31,7 @@ The following instructions will show you how to set up a Logpush job using an S3
3231

3332
<Details header="Generate a token for a specific bucket (recommended)">
3433

35-
Go to the R2 section of your Cloudflare dashboard and select **Manage R2 API Tokens** to generate a token directly tied to your specific bucket. You can follow the instructions in the [Authentication](/r2/api/s3/tokens/) section.
34+
Go to the R2 section of your Cloudflare dashboard and select **Manage R2 API Tokens** to generate a token directly tied to your specific bucket. You can follow the instructions in the [Authentication](/r2/api/tokens/) section.
3635

3736
</Details>
3837

@@ -54,19 +53,19 @@ The result:
5453

5554
```json
5655
{
57-
"result": {
58-
"id": "325xxxxcd",
59-
"status": "active"
60-
},
61-
"success": true,
62-
"errors": [],
63-
"messages": [
64-
{
65-
"code": 10000,
66-
"message": "This API Token is valid and active",
67-
"type": null
68-
}
69-
]
56+
"result": {
57+
"id": "325xxxxcd",
58+
"status": "active"
59+
},
60+
"success": true,
61+
"errors": [],
62+
"messages": [
63+
{
64+
"code": 10000,
65+
"message": "This API Token is valid and active",
66+
"type": null
67+
}
68+
]
7069
}
7170
```
7271

@@ -97,10 +96,8 @@ With Customer Metadata Boundary set to `EU`, **R2** > **Bucket** > [**Metrics**]
9796

9897
:::note
9998

100-
10199
Additionally, customers can create R2 buckets with [jurisdictional restrictions set to EU](/r2/reference/data-location/#jurisdictional-restrictions). In this case, we recommend [using jurisdictions with the S3 API](/r2/reference/data-location/#using-jurisdictions-with-the-s3-api).
102100

103-
104101
:::
105102

106103
Refer to the [R2 documentation](/r2/) for more information.

src/content/docs/logs/R2-log-retrieval.mdx

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ pcx_content_type: how-to
33
title: Logs Engine
44
sidebar:
55
order: 117
6-
76
---
87

9-
import { Details } from "~/components"
8+
import { Details } from "~/components";
109

1110
Logs Engine gives you the ability to store your logs in R2 and query them directly.
1211

@@ -17,12 +16,12 @@ Logs Engine is going to be replaced by Log Explorer. For further details, consul
1716

1817
## Store logs in R2
1918

20-
* Set up a [Logpush to R2](/logs/get-started/enable-destinations/r2/) job.
21-
* Create an [R2 access key](/r2/api/s3/tokens/) with at least R2 read permissions.
22-
* Ensure that you have Logshare read permissions.
23-
* Alternatively, create a Cloudflare API token with the following permissions:
24-
* Account scope
25-
* Logs read permissions
19+
- Set up a [Logpush to R2](/logs/get-started/enable-destinations/r2/) job.
20+
- Create an [R2 access key](/r2/api/tokens/) with at least R2 read permissions.
21+
- Ensure that you have Logshare read permissions.
22+
- Alternatively, create a Cloudflare API token with the following permissions:
23+
- Account scope
24+
- Logs read permissions
2625

2726
## Query logs
2827

@@ -32,49 +31,49 @@ You can use the API to query and download your logs by time range or RayID.
3231

3332
The following headers are required for all API calls:
3433

35-
* `X-Auth-Email` - the Cloudflare account email address associated with the domain
36-
* `X-Auth-Key` - the Cloudflare API key
34+
- `X-Auth-Email` - the Cloudflare account email address associated with the domain
35+
- `X-Auth-Key` - the Cloudflare API key
3736

3837
Alternatively, API tokens with Logs edit permissions can also be used for authentication:
3938

40-
* `Authorization: Bearer <API_TOKEN>`
39+
- `Authorization: Bearer <API_TOKEN>`
4140

4241
### Required headers
4342

4443
In addition to the required authentication headers mentioned, the following headers are required for the API to access logs stored in your R2 bucket.
4544

46-
`R2-access-key-id` (required) - [R2 Access Key Id](/r2/api/s3/tokens/)
47-
`R2-secret-access-key` (required) - [R2 Secret Access Key](/r2/api/s3/tokens/)
45+
- `R2-access-key-id` (required) - [R2 Access Key Id](/r2/api/tokens/)
46+
- `R2-secret-access-key` (required) - [R2 Secret Access Key](/r2/api/tokens/)
4847

4948
## List files
5049

5150
List relevant R2 objects containing logs matching the provided query parameters, using the endpoint `GET /accounts/{accountId}/logs/list`.
5251

5352
### Query parameters
5453

55-
* `start` (required) string (TimestampRFC3339) - Start time in RFC 3339 format, for example `start=2022-06-06T16:00:00Z`.
54+
- `start` (required) string (TimestampRFC3339) - Start time in RFC 3339 format, for example `start=2022-06-06T16:00:00Z`.
5655

57-
* `end` (required) string (TimestampRFC3339) - End time in RFC 3339 format, for example `end=2022-06-06T16:00:00Z`.
56+
- `end` (required) string (TimestampRFC3339) - End time in RFC 3339 format, for example `end=2022-06-06T16:00:00Z`.
5857

59-
* `bucket` (required) string (Bucket) - R2 bucket name, for example `bucket=cloudflare-logs`.
58+
- `bucket` (required) string (Bucket) - R2 bucket name, for example `bucket=cloudflare-logs`.
6059

61-
* `prefix` string (Prefix) - R2 bucket prefix logs are stored under, for example `prefix=http_requests/example.com/{DATE}`.
60+
- `prefix` string (Prefix) - R2 bucket prefix logs are stored under, for example `prefix=http_requests/example.com/{DATE}`.
6261

63-
* `limit` number (Limit) - Maximum number of results to return, for example `limit=100`.
62+
- `limit` number (Limit) - Maximum number of results to return, for example `limit=100`.
6463

6564
## Retrieve logs by time range
6665

6766
Stream logs stored in R2 that match the provided query parameters, using the endpoint `GET /accounts/{accountId}/logs/retrieve`.
6867

6968
### Query parameters
7069

71-
* `start` (required) string (TimestampRFC3339) - Start time in RFC 3339 format, for example `start=2022-06-06T16:00:00Z`
70+
- `start` (required) string (TimestampRFC3339) - Start time in RFC 3339 format, for example `start=2022-06-06T16:00:00Z`
7271

73-
* `end` (required) string (TimestampRFC3339) - End time in RFC 3339 format, for example `end=2022-06-06T16:00:00Z`
72+
- `end` (required) string (TimestampRFC3339) - End time in RFC 3339 format, for example `end=2022-06-06T16:00:00Z`
7473

75-
* `bucket` (required) string (Bucket) - R2 bucket name, for example `bucket=cloudflare-logs`
74+
- `bucket` (required) string (Bucket) - R2 bucket name, for example `bucket=cloudflare-logs`
7675

77-
* `prefix` string (Prefix) - R2 bucket prefix logs are stored under, for example `prefix=http_requests/example.com/{DATE}`
76+
- `prefix` string (Prefix) - R2 bucket prefix logs are stored under, for example `prefix=http_requests/example.com/{DATE}`
7877

7978
### Example API request
8079

@@ -133,52 +132,42 @@ curl --globoff "https://api.cloudflare.com/client/v4/accounts/{account_id}/logs/
133132

134133
## Troubleshooting
135134

136-
137135
<Details header="I am getting an error when accessing the API">
138136

139-
* **Error**: Time range returned too many results. Try reducing the time range and try again.
137+
- **Error**: Time range returned too many results. Try reducing the time range and try again.
140138

141139
HTTP status code `422` will be returned if the time range between the start and end parameters is too wide. Try querying a shorter time range if you are running into this limit.
142140

143-
* **Error**: Provided token does not have the required features enabled.
141+
- **Error**: Provided token does not have the required features enabled.
144142

145143
Contact your account representative to have the beta Logpull RayID Lookup subscription added to your account.
146144

147-
* **Error**: Time range returned too many results. Try reducing the time range and try again.
145+
- **Error**: Time range returned too many results. Try reducing the time range and try again.
148146

149147
High volume zones can produce many log files in R2. Try reducing your start and end time range until you find a duration that works best for your log volume.
150148

151-
152149
</Details>
153150

154-
155151
<Details header="How do I know what time range to index?">
156152

157153
Currently, there is no process to index logs as they arrive. If you have the RayID and know the time the request was made, try indexing the next 5-10 minutes of logs after the request was completed.
158154

159-
160155
</Details>
161156

162-
163157
<Details header="What is the time delay between when an event happens and when I can query for it?">
164158

165159
Logpush delivers logs in batches as soon as possible, generally in less than one minute. After this, logs can be accessed using Logs Engine.
166160

167-
168161
</Details>
169162

170-
171163
<Details header="Does R2 have retention controls?">
172164

173165
R2 does not currently have retention controls in place. You can query back as far as when you created the Logpush job.
174166

175-
176167
</Details>
177168

178-
179169
<Details header="Which datasets is Logs Engine compatible with?">
180170

181171
The retrieval API is compatible with all the datasets we support. The full list is available on the [Log fields](/logs/reference/log-fields/) section.
182172

183-
184173
</Details>

0 commit comments

Comments
 (0)