Skip to content

Commit ce6722f

Browse files
Added collect log code example
1 parent af0e807 commit ce6722f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/content/docs/ai-gateway/observability/logging.mdx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,25 @@ If you turn off logging and are using Logpush, this will prevent the response an
3434

3535
To override the default logging behavior set in the settings tab, you can define headers on a per-request basis.
3636

37-
## Collect logs (collect_logs)
37+
## Collect logs (cf-aig-collect-log)
3838

39-
The `collect_logs` header allows you to bypass the default log setting for the gateway. If the gateway is configured to save logs, the header will exclude the user prompt and model response data for that specific request. Conversely, if logging is disabled at the gateway level, this header will save the user prompt and model response data for that request.
39+
The `cf-aig-collect-log` header allows you to bypass the default log setting for the gateway. If the gateway is configured to save logs, the header will exclude the user prompt and model response data for that specific request. Conversely, if logging is disabled at the gateway level, this header will save the user prompt and model response data for that request.
4040

4141
In this example, the gateway is configured to save logs, however we do not want this specific request to save the user prompt and model response.
42+
43+
```bash
44+
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/openai/chat/completions \
45+
--header 'Authorization: Bearer $TOKEN' \
46+
--header 'Content-Type: application/json' \
47+
--header 'cf-aig-collect-log: false \
48+
--data ' {
49+
"model": "gpt-4o-mini",
50+
"messages": [
51+
{
52+
"role": "user",
53+
"content": "What is the email address and phone number of user123?"
54+
}
55+
]
56+
}
57+
'
58+
```

0 commit comments

Comments
 (0)