|
| 1 | +--- |
| 2 | +{} |
| 3 | + |
| 4 | +--- |
| 5 | + |
| 6 | +```bash |
| 7 | + curl --request PUT \ |
| 8 | + https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/{ruleset_id}} \ |
| 9 | + --header "X-Auth-Email: <EMAIL>" \ |
| 10 | + --header "X-Auth-Key: <API_KEY>" \ |
| 11 | + --header "Content-Type: application/json" \ |
| 12 | + --data '{ |
| 13 | + "rules": [ |
| 14 | + { |
| 15 | + "action": "log_custom_field", |
| 16 | + "expression": "true", |
| 17 | + "description": "Set Logpush custom fields for HTTP requests", |
| 18 | + "action_parameters": { |
| 19 | + "request_fields": [ |
| 20 | + { "name": "content-type" }, |
| 21 | + { "name": "x-forwarded-for" }, |
| 22 | + ], |
| 23 | + "transformed_request_fields": [ |
| 24 | + {"name": "host"} |
| 25 | + ], |
| 26 | + "response_fields": [ |
| 27 | + { "name": "server" }, |
| 28 | + { "name": "content-type" }, |
| 29 | + "raw_response_fields": [ |
| 30 | + { "name": "allow" } |
| 31 | + ], |
| 32 | + "cookie_fields": [ |
| 33 | + { "name": "__ga" }, |
| 34 | + { "name": "accountNumber" }, |
| 35 | + { "name": "__cfruid" } |
| 36 | + ] |
| 37 | + } |
| 38 | + } |
| 39 | + ] |
| 40 | + }' |
| 41 | + ``` |
| 42 | + |
| 43 | + ```json output |
| 44 | + { |
| 45 | + "result": { |
| 46 | + "id": "<RULESET_ID>", |
| 47 | + "name": "Zone-level phase entry point", |
| 48 | + "description": "This ruleset configures custom log fields.", |
| 49 | + "kind": "zone", |
| 50 | + "version": "2", |
| 51 | + "rules": [ |
| 52 | + { |
| 53 | + "id": "<RULE_ID_1>", |
| 54 | + "version": "1", |
| 55 | + "action": "log_custom_field", |
| 56 | + "action_parameters": { |
| 57 | + "request_fields": [ |
| 58 | + { "name": "content-type" }, |
| 59 | + { "name": "x-forwarded-for" }, |
| 60 | + "transformed_request_fields": [ |
| 61 | + { "name": "host" } |
| 62 | + ], |
| 63 | + "response_fields": [ |
| 64 | + { "name": "server" }, |
| 65 | + { "name": "content-type" }, |
| 66 | + "raw_response_fields": [ |
| 67 | + { "name": "allow" } |
| 68 | + ], |
| 69 | + "cookie_fields": [ |
| 70 | + { "name": "__ga" }, |
| 71 | + { "name": "accountNumber" }, |
| 72 | + { "name": "__cfruid" } |
| 73 | + ] |
| 74 | + }, |
| 75 | + "expression": "true", |
| 76 | + "description": "Set Logpush custom fields for HTTP requests", |
| 77 | + "last_updated": "2021-11-21T11:02:08.769537Z", |
| 78 | + "ref": "<RULE_REF_1>", |
| 79 | + "enabled": true |
| 80 | + } |
| 81 | + ], |
| 82 | + "last_updated": "2021-11-21T11:02:08.769537Z", |
| 83 | + "phase": "http_log_custom_fields" |
| 84 | + }, |
| 85 | + "success": true, |
| 86 | + "errors": [], |
| 87 | + "messages": [] |
| 88 | + } |
| 89 | + ``` |
0 commit comments