|
1098 | 1098 |
|
1099 | 1099 | Refer to the Cloudflare Workers API documentation for more information. |
1100 | 1100 |
|
| 1101 | + |
| 1102 | +## Cloudflare Instant Logs |
| 1103 | + |
| 1104 | +Please see https://developers.cloudflare.com/logs/instant-logs for all the information on how to use this feature. |
| 1105 | +The `cli4` command along with the Python libaries can be used to control the instant logs; however, the websocket reading is outside the scope of this library. |
| 1106 | + |
| 1107 | +To query the states of the instant logs: |
| 1108 | +``` |
| 1109 | +$ cli4 /zones/:███████████.com/logpush/edge/jobs | jq . |
| 1110 | +[] |
| 1111 | +$ |
| 1112 | +``` |
| 1113 | + |
| 1114 | +To add monitoring: |
| 1115 | +``` |
| 1116 | +$ cli4 --post \ |
| 1117 | + ='{ |
| 1118 | + "fields": "ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,EdgeEndTimestamp,EdgeResponseBytes,EdgeResponseStatus,EdgeStartTimestamp,RayID", |
| 1119 | + "sample": 1, |
| 1120 | + "filter": "", |
| 1121 | + "kind": "instant-logs" |
| 1122 | + }' \ |
| 1123 | + /zones/:███████████.com/logpush/edge/jobs | jq . |
| 1124 | +{ |
| 1125 | + "destination_conf": "wss://logs.cloudflare.com/instant-logs/ws/sessions/████████████████████████████████", |
| 1126 | + "fields": "ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,EdgeEndTimestamp,EdgeResponseBytes,EdgeResponseStatus,EdgeStartTimestamp,RayID", |
| 1127 | + "filter": "", |
| 1128 | + "kind": "instant-logs", |
| 1129 | + "sample": 1, |
| 1130 | + "session_id": "████████████████████████████████" |
| 1131 | +} |
| 1132 | +$ |
| 1133 | +``` |
| 1134 | + |
| 1135 | +To see the results: |
| 1136 | +``` |
| 1137 | +$ cli4 /zones/:███████████.com/logpush/edge/jobs | jq . |
| 1138 | +[ |
| 1139 | + { |
| 1140 | + "fields": "ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,EdgeEndTimestamp,EdgeResponseBytes,EdgeResponseStatus,EdgeStartTimestamp,RayID", |
| 1141 | + "filter": "", |
| 1142 | + "kind": "instant-logs", |
| 1143 | + "sample": 1, |
| 1144 | + "session_id": "████████████████████████████████" |
| 1145 | + } |
| 1146 | +] |
| 1147 | +$ |
| 1148 | +``` |
| 1149 | + |
1101 | 1150 | ## Cloudflare GraphQL |
1102 | 1151 |
|
1103 | 1152 | The GraphQL interface can be accessed via the command line or via Python. |
|
0 commit comments