Skip to content

Commit 3dff33c

Browse files
Adds APIRequest component to Logs docs (#23561)
1 parent e6e9dca commit 3dff33c

File tree

8 files changed

+286
-276
lines changed

8 files changed

+286
-276
lines changed

src/content/docs/logs/get-started/api-configuration.mdx

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ sidebar:
66

77
---
88

9+
import { APIRequest } from "~/components";
10+
911
## Endpoints
1012

1113
The table below summarizes the job operations available for both Logpush and Edge Log Delivery jobs. Make sure that Account-scoped datasets use `/accounts/{account_id}` and Zone-scoped datasets use `/zone/{zone_id}`. For more information, refer to the [Log fields](/logs/reference/log-fields/) page.
@@ -37,27 +39,24 @@ For concrete examples, refer to the tutorials in [Logpush examples](/logs/tutori
3739

3840
The Logpush API requires credentials like any other Cloudflare API.
3941

40-
```bash
41-
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/jobs \
42-
--header "X-Auth-Email: <EMAIL>" \
43-
--header "X-Auth-Key: <API_KEY>"
44-
```
42+
<APIRequest
43+
path="/zones/{zone_id}/logpush/jobs"
44+
method="GET"
45+
/>
4546

4647
## Ownership
4748

4849
Before creating a new job, ownership of the destination must be proven.
4950

5051
To issue an ownership challenge token to your destination:
5152

52-
```bash
53-
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/ownership \
54-
--header "X-Auth-Email: <EMAIL>" \
55-
--header "X-Auth-Key: <API_KEY>" \
56-
--header "Content-Type: application/json" \
57-
--data '{
58-
"destination_conf": "s3://<BUCKET_PATH>?region=us-west-2"
59-
}'
60-
```
53+
<APIRequest
54+
path="/zones/{zone_id}/logpush/ownership"
55+
method="POST"
56+
json={{
57+
destination_conf: "s3://<BUCKET_PATH>?region=us-west-2",
58+
}}
59+
/>
6160

6261
A challenge file will be written to the destination, and the filename will be in the response (the filename may be expressed as a path, if appropriate for your destination):
6362

@@ -143,15 +142,13 @@ For more information on the value for your cloud storage provider, consult the f
143142

144143
To check if a destination is already in use:
145144

146-
```bash
147-
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/validate/destination/exists \
148-
--header "X-Auth-Email: <EMAIL>" \
149-
--header "X-Auth-Key: <API_KEY>" \
150-
--header "Content-Type: application/json" \
151-
--data '{
152-
"destination_conf": "s3://foo"
153-
}'
154-
```
145+
<APIRequest
146+
path="/zones/{zone_id}/logpush/validate/destination/exists"
147+
method="POST"
148+
json={{
149+
destination_conf: "s3://foo",
150+
}}
151+
/>
155152

156153
Response
157154

@@ -182,22 +179,30 @@ The kind parameter cannot be used to update existing Logpush jobs. You can only
182179

183180
:::
184181

185-
```bash
186-
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/jobs \
187-
--header "X-Auth-Email: <EMAIL>" \
188-
--header "X-Auth-Key: <API_KEY>" \
189-
--header "Content-Type: application/json" \
190-
--data '{
191-
"name": "<DOMAIN_NAME>",
192-
"destination_conf": "s3://<BUCKET_PATH>?region=us-west-2",
193-
"dataset": "http_requests",
194-
"output_options": {
195-
"field_names": ["ClientIP", "ClientRequesrHost", "ClientRequestMethod", " ClientRequestURI", "EdgeEndTimestamp", "EdgeResponseBytes", "EdgeResponseStatus", "EdgeStartTimestamp","RayID"],
196-
"timestamp_format": "rfc3339"
197-
},
198-
"kind": "edge"
199-
}'
200-
```
182+
<APIRequest
183+
path="/zones/{zone_id}/logpush/jobs"
184+
method="POST"
185+
json={{
186+
name: "<DOMAIN_NAME>",
187+
destination_conf: "s3://<BUCKET_PATH>?region=us-west-2",
188+
dataset: "http_requests",
189+
output_options: {
190+
field_names: [
191+
"ClientIP",
192+
"ClientRequesrHost",
193+
"ClientRequestMethod",
194+
" ClientRequestURI",
195+
"EdgeEndTimestamp",
196+
"EdgeResponseBytes",
197+
"EdgeResponseStatus",
198+
"EdgeStartTimestamp",
199+
"RayID"
200+
],
201+
timestamp_format: "rfc3339"
202+
},
203+
kind: "edge"
204+
}}
205+
/>
201206

202207
## Options
203208

@@ -216,16 +221,14 @@ The **CVE-2021-44228** parameter can only be set through the API at this time. U
216221

217222
To check if the selected **logpull\_options** are valid:
218223

219-
```bash
220-
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/validate/origin \
221-
--header "X-Auth-Email: <EMAIL>" \
222-
--header "X-Auth-Key: <API_KEY>" \
223-
--header "Content-Type: application/json" \
224-
--data '{
225-
"logpull_options": "fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339&CVE-2021-44228=true",
226-
"dataset": "http_requests"
227-
}'
228-
```
224+
<APIRequest
225+
path="/zones/{zone_id}/logpush/validate/origin"
226+
method="POST"
227+
json={{
228+
logpull_options: "fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339&CVE-2021-44228=true",
229+
dataset: "http_requests"
230+
}}
231+
/>
229232

230233
Response
231234

src/content/docs/logs/instant-logs.mdx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 116
66
---
77

8-
import { FeatureTable } from "~/components";
8+
import { FeatureTable, APIRequest } from "~/components";
99

1010
Instant Logs allows Cloudflare customers to access a live stream of the traffic for their domain from the Cloudflare dashboard or from a command-line interface (CLI). Seeing data in real time allows you to investigate an attack, troubleshoot, debug or test out changes made to your network. Instant Logs is lightweight, simple to use and does not require any additional setup.
1111

@@ -66,18 +66,16 @@ Below we have three examples of filters:
6666

6767
Example request using cURL:
6868

69-
```bash
70-
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/edge/jobs \
71-
--header "X-Auth-Email: <EMAIL>" \
72-
--header "X-Auth-Key: <API_KEY>" \
73-
--header "Content-Type: application/json" \
74-
--data '{
75-
"fields": "ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,EdgeEndTimestamp,EdgeResponseBytes,EdgeResponseStatus,EdgeStartTimestamp,RayID",
76-
"sample": 100,
77-
"filter": "",
78-
"kind": "instant-logs"
79-
}'
80-
```
69+
<APIRequest
70+
path="/zones/{zone_id}/logpush/edge"
71+
method="POST"
72+
json={{
73+
fields: "ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,EdgeEndTimestamp,EdgeResponseBytes,EdgeResponseStatus,EdgeStartTimestamp,RayID",
74+
sample: 100,
75+
filter: "",
76+
kind: "instant-logs"
77+
}}
78+
/>
8179

8280
Response:
8381

0 commit comments

Comments
 (0)