You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/logs/reference/custom-fields.mdx
+16-18
Original file line number
Diff line number
Diff line change
@@ -3,19 +3,19 @@ pcx_content_type: how-to
3
3
title: Custom fields
4
4
sidebar:
5
5
order: 43
6
-
7
6
---
8
7
9
8
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
10
9
11
10
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.
12
11
13
12
:::note[By default:]
13
+
14
14
-**Request headers** are logged as **raw values**.
15
15
-**Response headers** are logged as **transformed values**.
16
-
:::
16
+
:::
17
17
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.
19
19
20
20
Custom fields can be enabled via API or the Cloudflare dashboard.
21
21
@@ -47,7 +47,7 @@ The `action_parameters` object that you must include in the rule that configures
47
47
"transformed_request_fields": [
48
48
{ "name": "<http_request_header_transformed>" }
49
49
],
50
-
//select raw or transformed (default) response header
50
+
//select raw or transformed (default) response header
51
51
"response_fields": [
52
52
{ "name": "<http_response_header_transformed>" }
53
53
],
@@ -62,11 +62,11 @@ The `action_parameters` object that you must include in the rule that configures
62
62
63
63
Ensure that your rule definition complies with the following:
64
64
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.
70
70
71
71
Perform the following steps to create the rule:
72
72
@@ -124,7 +124,7 @@ Perform the following steps to create the rule:
124
124
"response_fields": [
125
125
{ "name": "server" },
126
126
{ "name": "content-type" }
127
-
],
127
+
],
128
128
"raw_response_fields": [
129
129
{ "name": "allow" }
130
130
],
@@ -164,7 +164,7 @@ Perform the following steps to create the rule:
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.
219
218
220
-
221
219
:::
222
220
223
221
## 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
226
224
2. Go to **Analytics & Logs** > **Logpush**.
227
225
3. In the **Custom log fields** section, select **Edit Custom Fields**.
228
226
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**.
230
228
6. When you are done, select **Save**.
231
229
232
230
## Limitations
233
231
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