Skip to content

Commit 585ff20

Browse files
[Logs] Adds one click logpush instructions (#20550)
* Adds one click logpsuh instructions * Apply suggestions from code review Co-authored-by: marciocloudflare <[email protected]> * Changes after review. --------- Co-authored-by: marciocloudflare <[email protected]>
1 parent 8692998 commit 585ff20

File tree

2 files changed

+60
-6
lines changed
  • src

2 files changed

+60
-6
lines changed

src/assets/images/logs/logs-r2.png

221 KB
Loading

src/content/docs/logs/get-started/enable-destinations/r2.mdx

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,37 @@ sidebar:
88

99
import { Render } from "~/components"
1010

11-
Cloudflare Logpush supports pushing logs directly to R2 via the Cloudflare dashboard or via API.
11+
Cloudflare Logpush supports pushing logs directly to R2. You can do so via the automatic setup (Cloudflare creates an R2 bucket for you), or you can create your own R2 bucket with the custom setup. The automatic setup is ideal for quickly setting up a bucket or for testing purposes. Instead, use the custom setup if you need full control over the configuration.
1212

1313
For more information about R2, refer to the [Cloudflare R2](/r2/) documentation.
1414

15+
## Automatic setup
16+
17+
If you want to use the automatic setup for your logpush job:
18+
19+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login).
20+
21+
2. Select the Enterprise account or domain (also known as zone) you want to use with Logpush. Depending on your choice, you have access to [account-scoped datasets](/logs/reference/log-fields/account/) and [zone-scoped datasets](/logs/reference/log-fields/zone/), respectively.
22+
23+
3. Go to **Analytics & Logs** > **Logpush**.
24+
25+
4. Select **Create a Logpush job**.
26+
27+
5. Select **R2 Object Storage - automatic** as destination.
28+
29+
6. Next, select the dataset and the storage region you want to use.
30+
31+
7. To finalize, select **Create Logpush job**.
32+
33+
Your setup should now be complete. If you require full control over the configuration, consider using the custom setup instead.
34+
35+
## Custom setup
36+
37+
Cloudflare Logpush supports pushing logs directly to R2 via the Cloudflare dashboard or via API.
38+
1539
Before getting started:
1640

17-
* Create an R2 bucket and set up R2 API tokens.
41+
- Create an R2 bucket and set up R2 API tokens.
1842

1943
1. Go to the R2 UI > **Create bucket**.
2044

@@ -26,11 +50,11 @@ Before getting started:
2650

2751
5. Copy the Secret Access Key and Access Key ID. You will need these when setting up your Logpush job.
2852

29-
* Ensure that you have the following permissions:
53+
- Ensure that you have the following permissions:
3054

31-
* R2 write, Logshare Edit.
55+
- R2 write, Logshare Edit.
3256

33-
## Manage via the Cloudflare dashboard
57+
### Manage via the Cloudflare dashboard
3458

3559
<Render file="enable-logpush-job" />
3660

@@ -58,7 +82,7 @@ When you are done entering the destination details, select **Continue**.
5882

5983
10. Select **Submit** once you are done configuring your logpush job.
6084

61-
## Manage via API
85+
### Manage via API
6286

6387
To create a job, make a `POST` request to the Logpush jobs endpoint with the following fields:
6488

@@ -95,3 +119,33 @@ curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/jobs \
95119
"enabled": true
96120
}'
97121
```
122+
123+
## Download logs from R2
124+
125+
Once your logs are stored in R2, you can download them using various methods:
126+
127+
### Dashboard
128+
129+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/).
130+
131+
2. Navigate to R2 and select your bucket.
132+
133+
3. From your bucket's page, locate the desired log file.
134+
135+
4. Select on the **...** icon next to the file to download it.
136+
137+
![Log files list](~/assets/images/logs/logs-r2.png)
138+
139+
### AWS CLI
140+
141+
Cloudflare R2 is S3-compatible, so you can use the AWS CLI to interact with it.
142+
- Configure the AWS CLI with your R2 credentials.
143+
- Use the `aws s3 cp` command to download the log file:
144+
145+
```bash
146+
aws s3 cp s3://<BUCKET-NAME>/<PATH-TO-LOG-FILE><LOCAL-DESTINATION>`
147+
```
148+
149+
Replace `<bucket-name>`, `<path-to-log-file>`, and `<local-destination>` with your specific details.
150+
151+
Downloaded files are gzipped so they must be decompressed before you can open them in a text editor.

0 commit comments

Comments
 (0)