Skip to content

Commit de43b5e

Browse files
daisyfaithaumahyperlint-ai[bot]Maddy-Cloudflare
authored
[AIG] Updated logging (#16793)
* Updated logging * Update src/content/docs/ai-gateway/observability/persistent-logs.mdx URL Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> * Update src/content/docs/ai-gateway/observability/persistent-logs.mdx Grammar Co-authored-by: Maddy <[email protected]> * Update src/content/docs/ai-gateway/observability/persistent-logs.mdx Grammar Co-authored-by: Maddy <[email protected]> * Update src/content/partials/ai-gateway/logging.mdx Grammar Co-authored-by: Maddy <[email protected]> --------- Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> Co-authored-by: Maddy <[email protected]>
1 parent a62439a commit de43b5e

File tree

3 files changed

+50
-5
lines changed

3 files changed

+50
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
---
2-
title: Analytics and logging
2+
title: Analytics
33
pcx_content_type: reference
44
---
55

66
import { Render, TabItem, Tabs } from "~/components";
77

88
<Render file="analytics-overview" /> <br />
9+
These analytics help you understand traffic patterns, token consumption, and
10+
potential issues across different AI providers or individual providers. You can
11+
view the following analytics:
12+
13+
- **Requests**: View the total number of requests processed by the AI Gateway.
14+
- **Token Usage**: Analyze token consumption across all requests, giving insight into usage patterns and helping optimize token allocation.
15+
- **Costs**: Gain visibility into the costs associated with using different AI providers. This allows you to track spending, manage budgets, and optimize your resources.
16+
- **Error Rates**: Monitor the percentage of errors across requests, helping to identify and troubleshoot issues that may arise in provider responses.
17+
- **Cached Responses**: View the percentage of responses served from cache.
918

1019
## View analytics
1120

@@ -39,7 +48,3 @@ curl https://api.cloudflare.com/client/v4/graphql \
3948
The cost metric is an estimation based on the number of tokens sent and received in requests. While this metric can help you monitor and predict cost trends, refer to your provider’s dashboard for the most accurate cost details.
4049
4150
:::
42-
43-
## Logging
44-
45-
Your AI Gateway dashboard also shows real-time logs of individual requests, such as the prompt, response, provider, timestamps, and whether the request was successful, cached, or if there was an error. These logs now persist and can store up to 10,000 logs per gateway for better observability and analysis.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
pcx_content_type: reference
3+
title: Persistent logs(beta)
4+
sidebar:
5+
badge:
6+
text: Beta
7+
---
8+
9+
import { Render } from "~/components";
10+
11+
Logging is a fundamental building block for application development. Logging provides insights during the early stages of development and is often critical to understanding issues occurring in production.
12+
13+
Your AI Gateway dashboard shows logs of individual requests, including the user prompt, model response, provider, timestamp, request status, token usage, cost, and duration. These logs persist, giving you the flexibility to store them for your preferred duration and do more with valuable request data. You can store up to 10 million logs per gateway.
14+
15+
When you are nearing your plan limit, an alert will be displayed in the dashboard. If your limit is reached, new logs will stop being saved. To continue saving logs, you must delete older logs to free up space for new logs.
16+
17+
To learn more about your plan limits, refer to the [Pricing](/ai-gateway/pricing/) page.
18+
19+
## Default configuration
20+
21+
Logs, which include metrics as well as request and response data are enabled by default for each gateway. If you are concerned about privacy or compliance and want to turn log collection off, you can go to settings and opt out of logs.
22+
23+
<Render file="logging" />
24+
25+
This logging behavior will be uniformly applied to all requests in the gateway. If you need to modify the logging settings for specific requests, you can override this setting on a per-request basis.
26+
27+
:::note[Note]
28+
29+
If you turn off logging and are using Logpush, this will prevent the response and request body from being forwarded through Logpush.
30+
:::
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
{}
3+
---
4+
5+
To change the default log configuration in the dashboard:
6+
7+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account.
8+
2. Go to **AI** > **AI Gateway**.
9+
3. Select **Settings**.
10+
4. Change the **Logs** setting to your preference.

0 commit comments

Comments
 (0)