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
+42-2Lines changed: 42 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,9 +189,50 @@ Perform the following steps to create the rule:
189
189
}
190
190
```
191
191
192
+
#### Record duplicate response header values
193
+
194
+
Some headers sent from the origin — such as `set-cookie` — may have multiple values that you want to capture. You can use the Rulesets API to specify which headers should have all their values logged.
Note that `preserve_duplicates` applies to both `response_fields` and `raw_response_fields`. If there are no transform rules that affect a header, including `preserve_duplicates` in either `response_fields` or `raw_response_fields` should achieve the same result.
219
+
220
+
In this example, all values of the `set-cookie` headers will be logged. They will appear as an array of string values under `ResponseFields`, for example:
221
+
222
+
```json
223
+
{
224
+
…
225
+
“ResponseFields”: {
226
+
“set-cookie”: [“name1=val1”, “name2=val2”...]
227
+
}
228
+
}
229
+
```
230
+
231
+
You can use a worker or custom logic at your logpush destination to extract these values.
232
+
192
233
### 2. Include the custom fields in your Logpush job
193
234
194
-
Next, include `Cookies`, `RequestHeaders`, and/or `ResponseHeaders`, depending on your custom field configuration, in the list of fields of the `output_options` job parameter when creating or updating a job. The logs will contain the configured custom fields and their values in the request/response.
235
+
Next, include `Cookies`, `RequestHeaders`, `ResponseHeaders`, and/or `ResponseFields`, depending on your custom field configuration, in the list of fields of the `output_options` job parameter when creating or updating a job. The logs will contain the configured custom fields and their values in the request/response.
195
236
196
237
For example, consider the following request that creates a job that includes custom fields:
197
238
@@ -230,6 +271,5 @@ If you are a Cloudflare Access user, as of March 2022 you have to manually add t
230
271
## Limitations
231
272
232
273
- 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
274
- The request header `Range` is currently not supported by Custom Fields.
235
275
- 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