|
| 1 | +# UI Spend Log Settings |
| 2 | + |
| 3 | +Configure spend log behavior directly from the Admin UI—no config file edits or proxy restart required. This is especially useful for cloud deployments where updating the config is difficult or requires a long release process. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Previously, spend log options (such as storing request/response content and retention period) had to be set in `proxy_config.yaml` under `general_settings`. Changing them required editing the config and restarting the proxy, which was a pain point for users-especially in cloud environments—who don't have easy access to the config or whose deployment process makes config updates slow. |
| 8 | + |
| 9 | +<Image img={require('../../img/ui_spend_logs_settings.png')} /> |
| 10 | + |
| 11 | +**UI Spend Log Settings** lets you: |
| 12 | + |
| 13 | +- **Store prompts in spend logs** – Enable or disable storing request and response content in the spend logs table (only affects logs created after you change the setting) |
| 14 | +- **Set retention period** – Configure how long spend logs are kept before automatic cleanup (e.g. `7d`, `30d`) |
| 15 | +- **Apply changes immediately** – No proxy restart needed; settings take effect for new requests as soon as you save |
| 16 | + |
| 17 | +:::warning UI overrides config |
| 18 | +Settings changed in the UI **override** the values in your config file. For example, if `store_prompts_in_spend_logs` is explicitly set to `false` in `general_settings`, turning it on in the UI will still enable storing prompts. Use the UI when you want runtime control without redeploying. |
| 19 | +::: |
| 20 | + |
| 21 | +## Settings You Can Configure |
| 22 | + |
| 23 | +| Setting | Description | |
| 24 | +| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 25 | +| **Store Prompts in Spend Logs** | When enabled, request messages and response content are stored for **new** spend logs so you can view them in the Logs UI. Logs created before you enabled this will not have request/response content. When disabled, only metadata (e.g. tokens, cost, model) is stored for new logs. | |
| 26 | +| **Retention Period** | Maximum time to keep spend logs before they are automatically deleted (e.g. `7d`, `30d`). Optional; if not set, logs are retained according to your config or default behavior. | |
| 27 | + |
| 28 | +The same options can be set in config via [general_settings](./config_settings.md#general_settings---reference) (`store_prompts_in_spend_logs`, `maximum_spend_logs_retention_period`). Values set in the UI take precedence. |
| 29 | + |
| 30 | +## How to Configure Spend Log Settings in the UI |
| 31 | + |
| 32 | +### 1. Open the Logs page |
| 33 | + |
| 34 | +Navigate to the Admin UI (e.g. `http://localhost:4000/ui` or your `PROXY_BASE_URL/ui`) and click **Logs**. |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +### 2. Open Logs settings |
| 41 | + |
| 42 | +Click the **Settings** (gear) icon on the Logs page to open the spend log settings panel. |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +### 3. Enable Store Prompts in Spend Logs (optional) |
| 47 | + |
| 48 | +Turn on **Store Prompts in Spend Logs** if you want request and response content to be stored for new requests and visible when you open those log entries. This only affects logs created after you enable it; existing logs will not gain request/response content. Leave it off if you only need metadata (tokens, cost, model, etc.). |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +### 4. Set the retention period (optional) |
| 53 | + |
| 54 | +Optionally set the **Retention Period** (e.g. `7d`, `30d`) to control how long spend logs are kept before automatic cleanup. Uses the same format as the config option `maximum_spend_logs_retention_period`. |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +### 5. Save settings |
| 59 | + |
| 60 | +Click **Save Settings**. Changes take effect immediately for new requests; no proxy restart is required. Existing logs are not updated. |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +### 6. Verify: view request and response in a log |
| 65 | + |
| 66 | +After enabling **Store Prompts in Spend Logs**, make a new request through the proxy, then open that log entry (or any other log created after you enabled the setting). The log details view will include the request and response content. Logs that existed before you turned the setting on will not have this content. |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +## Use Cases |
| 73 | + |
| 74 | +### Cloud and managed deployments |
| 75 | + |
| 76 | +When the proxy runs in a managed or cloud environment, config may be in a separate repo, require a long release, or be controlled by another team. Using the UI lets you change spend log behavior (e.g. enable prompt storage for debugging or set retention) without going through that process. |
| 77 | + |
| 78 | +### Quick toggles for debugging |
| 79 | + |
| 80 | +Temporarily enable **Store Prompts in Spend Logs** to inspect request/response content on new requests when debugging, then turn it off again from the UI without editing config or restarting. Only logs created while the setting was on will contain the content. |
| 81 | + |
| 82 | +### Retention without redeploying |
| 83 | + |
| 84 | +Adjust how long spend logs are retained (e.g. shorten to reduce storage or extend for compliance) and have the new retention period and cleanup job take effect immediately. |
| 85 | + |
| 86 | +## Related Documentation |
| 87 | + |
| 88 | +- [Getting Started with UI Logs](./ui_logs.md) – Overview of what gets logged and config-based options |
| 89 | +- [Config Settings](./config_settings.md) – `store_prompts_in_spend_logs`, `disable_spend_logs`, `maximum_spend_logs_retention_period` in `general_settings` |
| 90 | +- [Spend Logs Deletion](./spend_logs_deletion.md) – How retention and cleanup work |
0 commit comments