# Email reports: daily, weekly and monthly

With BoxLang+, BxLens can email an admin a short report of how the whole cluster did. It is set up next to the alerts, in **Settings, Notifications** (see [Notifications](notifications.md) for the SMTP settings and the recipients).

## Who gets what

In the list of recipients, tick **daily**, **weekly** and **monthly** for each person. Under **Reports** choose:

| Setting | Meaning |
|---|---|
| Sent at, zone | The time of day and the time zone (the zone of the server when empty). |
| Weekly on | The weekday of the weekly report (Monday by default). |
| Monthly from day | The day of the month, 1 to 28 (the 1st by default). A server that was down on that day sends it as soon as it is up. |

One server sends for the whole cluster, the same one that sends alerts. A report is sent once: the last one sent is remembered in the store, so a restart or another server taking over never sends it twice.

## What is in a report

A report covers a run of **UTC days** that ends yesterday, set against the run just before it:

| Report | Covers | Compared with |
|---|---|---|
| Daily | Yesterday | The day before |
| Weekly | The seven days before today | The seven days before those |
| Monthly | The whole calendar month before this one | The month before it |

It holds, for all servers added together and then per server:

- **Highlights** in plain words: requests up or down on the period before, the failed share, alerts that fired, a deadlock, restarts, a heap peak over 90%.
- **Traffic:** requests, failed share, average time, slow requests, exceptions.
- **Mail** (when the Mail integration is on): sent and failed.
- **Capacity:** the heap and CPU peaks, and the fullest volume of each server.
- **Alerts** that fired, by name.
- **Top errors**: the five error groups seen in the period, merged across servers.
- **Outgoing HTTP**: the five hosts with the most failed calls, from the saved HTTP rollups.

It says how many of the server days it wanted it could find, for example "Data found for 12 of 14 server days".

## Preview and send now

**Preview daily, weekly, monthly** builds the report and shows it in a locked frame, without sending anything. **Send daily now** (and weekly, monthly) mails it to everyone who gets it, or to one address you type, to check how it looks in your mail client.

## What it needs

- The disk store must be on (`store.enabled`). Each server saves one small document per day (the counters of its requests, its peaks, its alerts), and keeps it for `store.retentionDays` days. The default is 15 days, so a **monthly** report needs `store.retentionDays` of 30 to cover the whole month. With less, the report says it found part of the month.
- Days start counting from the first minute a server with this version ran. There is no history before that.
- The AI integration is not part of the report yet.

## Safety

The same rules as alerts: admin only, BoxLang+, every change audited, nothing from the data goes into the HTML without escaping, and the preview runs in a sandboxed frame without scripts or network.
