Lab 8: Budgets, Rate Limits & Logs¶
LLMs are billed by the token, so a client in a loop is a cost problem and a capacity problem at the same time (OWASP LLM10 — Unbounded Consumption). In this lab you stop a runaway client with rate limits and budgets, and you use the logs and analytics to answer who used the model, how, at what cost, and what FortiAIGate did.
🎯 Lab Objectives¶
In this lab, you will:
- Trigger an HTTP 429 with a rate limit.
- Trigger an HTTP 402 with a budget.
- Review Usage, Cost and Analytics.
- Investigate requests in the Traffic Log.
🧭 How Limits Work¶
Every request must satisfy every limit that applies to it. Unlimited removes only that one cap.
| Level | Configured by | Behavior |
|---|---|---|
| Organization | Org admin | Shared total for everything |
| Workspace | Org admin | Shared total for the team, plus workspace RPM and TPM |
| Workspace member | Workspace admin | Individual cap inside the workspace |
| Project | Workspace admin | Cumulative total for the project keys, no automatic reset |
| Virtual key | Workspace admin | Hourly, daily, weekly and monthly windows, each enforced |
1. Rate Limits and Budgets¶
Step 1 – Rate limit (HTTP 429)
Navigate to: Virtual Keys > hr-chatbot-key > ⋮ > Edit.
- RPM:
2
Click Save, then send four short prompts in less than a minute.

Expected result:
- The third request fails with HTTP 429
rate_limit_exceeded. - Limits use fixed one-minute windows.
Remove the RPM value when you finish.
Step 2 – Budget (HTTP 402)
Navigate to: Virtual Keys > hr-chatbot-key > ⋮ > Edit > Key Budget > Add Window.
- Window:
Daily - Amount:
0
Click Save and send any prompt.

Expected result:
- The request fails with HTTP 402
budget_exceeded. - The key shows as
Suspendedin the key list.
Set the daily budget to 0.01 and send prompts again. Spending is recorded after each response, so the request that crosses the limit is completed and the next one is refused.

Remove the budget window when you finish.
2. Usage, Cost and Analytics¶
Step 3 – Review the dashboards
In your Workspace portal, open:
| Page | What to look at |
|---|---|
Usage |
Tokens Served, Requests Served, Active Keys and Rankings by key and model |
Cost |
Total Spend, Avg Cost/Request and Cost per 1K tokens for your workspace |
Analytics |
Inspected %, Violation rate, Blocked, Violation Trend, Top Violations and Scanner Latency (p50, p95, p99) |



Scanner latency is the time added by inspection, separate from the model's generation time.
3. Traffic Log Investigation¶
Step 4 – Find the evidence
Navigate to: Logs > Traffic Log and use the filters Verdict, Virtual Key, Model and Request Path to find:
- One request blocked by
HR-Prompt-Injection. - One request redacted by
HR-DLP-Redact, comparingOriginalandModified. - One request refused by the rate limit or the budget.
- One request refused for an unapproved model or a revoked key.
For each one, write down the request ID, verdict, detector and detector version.

Step 5 – Log forwarding (instructor demo)
FortiAIGate 8.0.2 forwards traffic logs and audit logs to an external Syslog collector over UDP (Organization > General > Log Forwarding). The instructor shows the events arriving at the collector.

Local logs are deleted automatically when the database fills up: the oldest records first at 80% and the oldest day at 90%. For audit and compliance, the external collector is the system of record.
🏁 Conclusion¶
Lab Completed!
You protected an HR chatbot with FortiAIGate 8.0.2:
- A virtual key per application, scoped to your workspace and project.
- Prompt injection, data leakage and harmful content blocked or redacted in both directions.
- Only approved models, with keys that can be rotated and revoked.
- Budgets and rate limits that stop runaway cost.
- A full audit trail of every request.