Skip to content

Commit 68a03b1

Browse files
Sahidyakodster28soheiokamoto
authored
Removed limitation on transformed headers (#21857)
* Removed limitation on transformed headers * Updated Limitations section * Update src/content/docs/logs/reference/custom-fields.mdx Co-authored-by: Sohei Okamoto <sohei.okamoto@gmail.com> --------- Co-authored-by: Kody Jackson <kody.s.jackson@gmail.com> Co-authored-by: Sohei Okamoto <sohei.okamoto@gmail.com>
1 parent ed82311 commit 68a03b1

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

src/content/docs/logs/reference/custom-fields.mdx

+16-18
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ pcx_content_type: how-to
33
title: Custom fields
44
sidebar:
55
order: 43
6-
76
---
87

98
The HTTP requests dataset includes most standard log information by default. However, if you need to capture additional request or response headers or cookies, you can use custom fields to tailor the logs to your specific needs
109

1110
Custom fields are configured per zone and, once set up, are enabled for all Logpush jobs in that zone that use the HTTP requests dataset and include the request headers, response headers, or cookie fields. You can log these fields in their raw form or as transformed values.
1211

1312
:::note[By default:]
13+
1414
- **Request headers** are logged as **raw values**.
1515
- **Response headers** are logged as **transformed values**.
16-
:::
16+
:::
1717

18-
This default behavior can be changed. You can configure either request or response headers to be logged as raw or transformed, depending on your needs - but not both for the same header.
18+
This default behavior can be changed. You can configure either request or response headers to be logged as raw or transformed, depending on your needs - but not both for the same header.
1919

2020
Custom fields can be enabled via API or the Cloudflare dashboard.
2121

@@ -47,7 +47,7 @@ The `action_parameters` object that you must include in the rule that configures
4747
"transformed_request_fields": [
4848
{ "name": "<http_request_header_transformed>" }
4949
],
50-
//select raw or transformed (default) response header
50+
//select raw or transformed (default) response header
5151
"response_fields": [
5252
{ "name": "<http_response_header_transformed>" }
5353
],
@@ -62,11 +62,11 @@ The `action_parameters` object that you must include in the rule that configures
6262

6363
Ensure that your rule definition complies with the following:
6464

65-
* You must include at least one of the following arrays in the `action_parameters` object: `request_fields`, `response_fields`, and `cookie_fields`.
66-
* You must enter HTTP request and response header names in lower case.
67-
* Cookie names are case sensitive — you must enter cookie names with the same capitalization they have in the HTTP request.
68-
* You must set the rule expression to `true`.
69-
* You can only log raw or transformed values for either request or response headers but not both for the same header.
65+
- You must include at least one of the following arrays in the `action_parameters` object: `request_fields`, `transformed_request_fields`, `response_fields`, `raw_response_fields`, and `cookie_fields`.
66+
- You must enter HTTP request and response header names in lower case.
67+
- Cookie names are case sensitive — you must enter cookie names with the same capitalization they have in the HTTP request.
68+
- You must set the rule expression to `true`.
69+
- You can only log raw or transformed values for either request or response headers but not both for the same header.
7070

7171
Perform the following steps to create the rule:
7272

@@ -124,7 +124,7 @@ Perform the following steps to create the rule:
124124
"response_fields": [
125125
{ "name": "server" },
126126
{ "name": "content-type" }
127-
],
127+
],
128128
"raw_response_fields": [
129129
{ "name": "allow" }
130130
],
@@ -164,7 +164,7 @@ Perform the following steps to create the rule:
164164
"response_fields": [
165165
{ "name": "server" },
166166
{ "name": "content-type" },
167-
"raw_response_fields": [
167+
"raw_response_fields": [
168168
{ "name": "allow" }
169169
],
170170
"cookie_fields": [
@@ -214,10 +214,8 @@ curl https://api.cloudflare.com/client/v4/zones/{zone_id}/logpush/jobs \
214214

215215
:::note[Note for Cloudflare Access users]
216216

217-
218217
If you are a Cloudflare Access user, as of March 2022 you have to manually add the `cf-access-user` user identity header to your logs by creating a custom fields ruleset or adding the `cf-access-user` HTTP request header to your custom fields configuration. Additionally, make sure that you include the `RequestHeaders` field in your Logpush job.
219218

220-
221219
:::
222220

223221
## Enable custom fields via dashboard
@@ -226,12 +224,12 @@ If you are a Cloudflare Access user, as of March 2022 you have to manually add t
226224
2. Go to **Analytics & Logs** > **Logpush**.
227225
3. In the **Custom log fields** section, select **Edit Custom Fields**.
228226
4. Select **Set new Custom Field**.
229-
5. From the **Field Type** dropdown, select *Request Header*, *Response Header* or *Cookies* and type the **Field Name**.
227+
5. From the **Field Type** dropdown, select _Request Header_, _Response Header_ or _Cookies_ and type the **Field Name**.
230228
6. When you are done, select **Save**.
231229

232230
## Limitations
233231

234-
* For headers which may be included multiple times (for example, the `set-cookie` response header), a custom field will only log the first instance of the header. Subsequent headers of the same type will be ignored.
235-
* Currently, Cloudflare only logs original request/response headers. Headers that were modified earlier in the request lifecycle with [Transform Rules](/rules/transform/) will not be logged.
236-
* The request header `Range` is currently not supported by Custom Fields.
237-
* Transformed and raw values for request and response headers are available only via the API and cannot be set through the UI.
232+
- Custom fields allow 100 headers per field type — this applies separately to `request_fields`, `transformed_request_fields`, `response_fields`, `raw_response_fields`, and `cookie_fields`.
233+
- For headers which may be included multiple times (for example, the `set-cookie` response header), a custom field will only log the first instance of the header. Subsequent headers of the same type will be ignored.
234+
- The request header `Range` is currently not supported by Custom Fields.
235+
- Transformed and raw values for request and response headers are available only via the API and cannot be set through the UI.

0 commit comments

Comments
 (0)