Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 49 additions & 52 deletions src/content/docs/logs/get-started/api-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ sidebar:

---

import { APIRequest } from "~/components";

## Endpoints

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.
Expand Down Expand Up @@ -39,24 +37,27 @@ For concrete examples, refer to the tutorials in [Logpush examples](/logs/tutori

The Logpush API requires credentials like any other Cloudflare API.

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

## Ownership

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

To issue an ownership challenge token to your destination:

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

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):

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

To check if a destination is already in use:

<APIRequest
path="/zones/{zone_id}/logpush/validate/destination/exists"
method="POST"
json={{
destination_conf: "s3://foo",
}}
/>
```bash
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/validate/destination/exists \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"destination_conf": "s3://foo"
}'
```

Response

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

:::

<APIRequest
path="/zones/{zone_id}/logpush/jobs"
method="POST"
json={{
name: "<DOMAIN_NAME>",
destination_conf: "s3://<BUCKET_PATH>?region=us-west-2",
dataset: "http_requests",
output_options: {
field_names: [
"ClientIP",
"ClientRequesrHost",
"ClientRequestMethod",
" ClientRequestURI",
"EdgeEndTimestamp",
"EdgeResponseBytes",
"EdgeResponseStatus",
"EdgeStartTimestamp",
"RayID"
],
timestamp_format: "rfc3339"
},
kind: "edge"
}}
/>
```bash
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/jobs \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"name": "<DOMAIN_NAME>",
"destination_conf": "s3://<BUCKET_PATH>?region=us-west-2",
"dataset": "http_requests",
"output_options": {
"field_names": ["ClientIP", "ClientRequesrHost", "ClientRequestMethod", " ClientRequestURI", "EdgeEndTimestamp", "EdgeResponseBytes", "EdgeResponseStatus", "EdgeStartTimestamp","RayID"],
"timestamp_format": "rfc3339"
},
"kind": "edge"
}'
```

## Options

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

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

<APIRequest
path="/zones/{zone_id}/logpush/validate/origin"
method="POST"
json={{
logpull_options: "fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339&CVE-2021-44228=true",
dataset: "http_requests"
}}
/>
```bash
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/validate/origin \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"logpull_options": "fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339&CVE-2021-44228=true",
"dataset": "http_requests"
}'
```

Response

Expand Down
24 changes: 13 additions & 11 deletions src/content/docs/logs/instant-logs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 116
---

import { FeatureTable, APIRequest } from "~/components";
import { FeatureTable } from "~/components";

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.

Expand Down Expand Up @@ -66,16 +66,18 @@ Below we have three examples of filters:

Example request using cURL:

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

Response:

Expand Down
Loading