> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/data-logging.md).

# Data logging and the archive log

The RTU log and the archive log, how much each holds, and how to plan how long the log lasts.

The XL4 Plus logs data in two tiers. The **RTU log** holds the points you set up in DATRAN VI until DATRAN collects them. The **archive log**, on units with the archive memory chip and firmware V7.19, keeps a long-term backup of the RTU log. How much each holds depends on the firmware version and the memory chips fitted.

{% hint style="info" %}
**Applies to:** XL4 Plus, firmware v7.x. Logging more than 35 points needs V7.18 or later; the archive log needs V7.19.
{% endhint %}

## In this section

* [Set up RTU data logging in DATRAN VI](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/data-logging/set-up-rtu-data-logging.md)
* [Set up the archive log](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/data-logging/archive-log.md)
* [Recover logged data manually](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/data-logging/recover-logged-data.md): when DATRAN can't reach the site

## What each version can log

|                                       | V7.17        | V7.18                  | V7.19                        |
| ------------------------------------- | ------------ | ---------------------- | ---------------------------- |
| Datagram version                      | 2            | 2                      | 2                            |
| Data log database version             | 2            | 3                      | 3                            |
| Maximum storage                       | 0.5 MB       | 5.5 MB                 | 124 MB (archive)             |
| Maximum records                       | About 64,000 | About 1 million        | About 20 million (archive)   |
| Maximum request block                 | 2.8 KB       | 32 KB                  | N/A                          |
| Maximum logged points                 | 35           | 255                    | 255                          |
| Minimum log interval                  | 1 s          | 1 s                    | 1 s                          |
| Time to Fill (35 points 1 min logged) | 1.3 days     | 3 weeks                | 1.25 years                   |
| Retrieve the RTU log by               | HDI, serial  | HDI, serial, USB stick | HDI, serial, USB stick, HTTP |
| Retrieve the archive log by           | –            | –                      | HTTP                         |

HDI is DATRAN's historical data interface, which collects the log automatically. Serial means copying it with Workbench over USB. HTTP means XL4-Connect over a LAN.

The RTU log is a circular buffer: when it's full, the oldest records are overwritten. Collecting it doesn't erase it.

## How big is my RTU log?

On V7.18 and later, the RTU log's size depends on the NOR flash chip. To check which chip you have, see [Which version do I have?](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/which-version.md)

| NOR flash chip     | RTU log size | Approximate records |
| ------------------ | ------------ | ------------------- |
| 4 MB (SST39FV3201) | 1.5 MB       | 240,000             |
| 8 MB (SST39FV6401) | 5.5 MB       | 880,000             |

## Plan how long the log will last

QTech's XL4 Plus Datalogging Capacity Calculator is a free Excel spreadsheet: ask QTech for it. It works out how many records your logging produces, and how long until the log starts overwriting itself if DATRAN or Workbench doesn't collect it.

Enter values in the orange cells; results show in the green cells. Don't change the **Internal** sheet.

1. Enter the database size for your chip: **1.5** for a 4 MB chip, **5.5** for an 8 MB chip.
2. In **Interval logged Analogs**, enter how many analogue points you log, and their logging interval.
3. Type **False** in the column marked **extended address**.
4. Read the results: how many records the log holds, how many are written each hour, and how long until it fills.

Then refine it:

* **Different intervals:** add a row for each interval. Points logged faster produce more records.
* **Extended addressing:** points numbered above 255 (for example RAI300) use extended addressing, which takes an extra byte per record. Set **TRUE** for those rows.
* **Event-logged analogues:** these log when the value changes by more than the dead band, so estimate how often that happens. For example, 30 means about every 30 seconds.
* **Event-logged digitals:** used rarely, because DATRAN usually gets digital changes straight away as change-of-state messages. One case is a small top-up pump that runs often for short periods. If it runs about 3 times an hour, enter 1200 (seconds).
* **The archive log:** if you want to see how much storage capacity it will have to start with, type 128 as the Database size.

Limits:

* Up to 255 logged points in total.
* Digital points cannot be logged at intervals in a QTech RTU, they are only logged when they change state.
* The spreadsheet takes up to 20 rows.
* Most logging is every minute. Log at 10 seconds or faster sparingly, for example while checking an instrument.
