> 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/xl4-connect/download-the-archive-log.md).

# Download the archive log

Download the archive log or the RTU log with XL4-Connect, read the log statistics, change the settings and view a downloaded log.

Click **Download** to download the entire log or enter a date and time to request data in a range from a start date/time to a stop date/time. The log file (.db) can be imported to the DATRAN SQL Database using the DATRAN Database Import utility.

{% hint style="info" %}
**Applies to:** XL4-Connect V1.00, with a DATRAN XL4 Plus RTU with the archive log turned on. From the XL4-Connect User Guide v01. To turn on the archive log, see [Set up the archive log](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/data-logging/archive-log.md).
{% endhint %}

## Download the archive log

1. Connect to the RTU: see [Install and connect](https://help.qtech.co.nz/datran/datran-telemetry/xl4-connect/install-and-connect.md).
2. Click the **View Archive Log** button or the sidebar menu option to display the archive status. For example, you can see the time period, over which the log spans.
3. Click **Download** to download the entire log or enter a date and time to request data in a range from a start date/time to a stop date/time. You can leave one or other of these options blank for example leave “request data to” blank if you want to retrieve all data from a start time to the end of the log.
4. Provide a filename and path for the log file to be saved. Click **Save** and the download will commence.
5. Occasionally the download from the archive will fail. Clicking the **Resume** button will attempt to pick up the download where it last left off. Alternatively, you can click **Clear** then start again.
6. Once complete, navigate to the downloaded file using file explorer.

To update the status of the Archive log click the sync icon.

### Import the log into DATRAN

Download and install the QTech DATRAN Database import utility from the SMA support area of the QTech web site as well as the user manual. This utility provides a similar function to the DATRAN Historical Data Interface (HDI) service in DATRAN which automatically stores data to the SQL Server Database. Instead, the utility operates on the downloaded log file to map the log data to datapoints in your SCADA system. It requires login access credentials to connect to your SQL Server and this function is generally performed by IT staff or DATRAN Operators. Also see [Recover logged data manually](https://help.qtech.co.nz/datran/datran-telemetry/datran-xl4-plus-rtu/data-logging/recover-logged-data.md).

## Download the RTU log

1. Connect to the RTU.
2. From the Home screen click **View RTU Log** or click **RTU Log** in the sidebar menu to view the Statistics for the RTU log and download it.
3. Click the **Download** button then (optionally) provide a filename and folder path to store the log to disk, then click **Save RTU log** in the dialogue box to commence the download.

The RTU log can only be downloaded as a whole, given that this would be the preferred action when responding to a time critical requirement to retrieve the log. The application will suggest a filename with a timestamp and device identifier to provide a unique filename each time the log is downloaded. The download can be cancelled by clicking the cancel button but it cannot be resumed and the whole log must be re-downloaded.

## Archive log statistics

| Item             | What it shows                                                                                                                                                                             | Typically                            |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| Backup Running   | This indicates the state of the archive logging task in the RTU.                                                                                                                          | Untick to stop                       |
| Archive Capacity | This is the total memory size (in bytes and in database records)                                                                                                                          | Typically > 20M records              |
| Archive Occupied | This represents the number of records currently stored in the Archive log.                                                                                                                | 0-100%                               |
| Oldest Record    | This refers to the timestamp of the oldest Record in the log                                                                                                                              |                                      |
| Newest Record    | This refers to the timestamp of the newest Record in the log.                                                                                                                             |                                      |
| Archive Timespan | The difference between oldest and newest record. Useful to look at the date range that the log covers.                                                                                    |                                      |
| Bad Block Count  | This is a measure of the number of damaged memory blocks that can no longer safely store and is a naturally occurring effect in flash memory devices                                      | Increases slowly with age over years |
| ECC Mode         | Indicates the algorithm for inbuilt error detection and correction in the memory chip. When troubleshooting memory log issues, report it to QTech if log capacity is unusually diminished |                                      |

* Unchecking this backup running checkbox will stop the task, disable the backup and all archiving will cease logging until the item is checked again (via the app or workbench).
* The log capacity is a fixed amount but may reduce over time as some blocks in the memory become unusable due to age. The firmware does not allocate the full amount of the memory chip because some space is reserved for other purposes and for database overheads.
* The Archive Occupied increases over time as the RTU log is backed up until eventually it will show 100%. After which it will remain at 100% but the oldest logs will be overwritten and the timespan that the log represents will shift. It is not normally necessary to clear the log because the timespan is the important factor and users are free to download periods of interest rather than the whole log, if desired.
* The Archive log newest record will lag somewhat behind the newest record in the RTU log because the Archive log is only updated when enough RTU log records have been recorded to fill a page in the Archive log.

## RTU log statistics

| Item                 | What it shows                                                                                         | Typically            |
| -------------------- | ----------------------------------------------------------------------------------------------------- | -------------------- |
| RTU Log Capacity     | This is the total memory size (in bytes and in database records)                                      | Typically 1M records |
| RTU Log Occupied     | This represents the number of records currently stored in the RTU log.                                | 0-100%               |
| Oldest Record        | This refers to the timestamp of the oldest Record in the log                                          |                      |
| Newest Record        | This refers to the timestamp of the newest Record in the log.                                         |                      |
| RTU Log Timespan     | The difference between oldest and newest record. Useful to look at the date range that the log covers |                      |
| Logged Last Hour     | An indicative measurement of the logging rate                                                         |                      |
| Logged Last 24 Hours | Running total of the number of log entries                                                            |                      |

* On older RTUs (prior to about 2018) especially those that have been upgraded from XL4 to XL4 Plus firmware, the memory chip may be smaller in capacity and have only about a quarter of the capacity.
* The HDI service in DATRAN will regularly upload most if not all the records in the RTU log so that only the new logs created in the RTU log in the interim between upload requests are pending upload. If the HDI service fails then the RTU log will eventually fill and overwrite with new data and the unsecured pending records will be lost. This is why the Archive log adds more resilience by backing up the pending logs and providing a larger time window to go to site and collect the RTU/Archive logs when the communications system is down.
* Useful metrics include the hourly logging rate and the number of logs created over the last 24 Hours. If these metrics change from the expected values, this may indicate some issue with the logging function of the RTU or that the configuration of the log as specified in the `_comms_hist_data_` object in the DATRAN TBD database has changed.

## Settings

Clicking the **Settings** sidebar menu item allows you to change application settings:

![XL4-Connect Settings: time zone, theme, block sizes, automatic retries and retry delay](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2FXojeEUSTjHH4UiwK6yjO%2Fxl4-connect-settings.png?alt=media)

| Setting                        | What it does                                                                                                                                                                                                     | Default    |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| Time Zone                      | All log records are recorded in UTC (GMT) but the view can be changed so that they are requested or displayed according to regional time zone. If you want to see the records as stored use the UTC time setting | Local time |
| Theme                          | The display can be rendered in a light or dark theme                                                                                                                                                             | Light      |
| RTU Log Request Block Size     | Data can be retrieved from the RTU log. This defines the sizes of the data packet it should be adjusted for the communications channel capacity                                                                  | 128 KB     |
| Archive Log Request Block Size | Data can be retrieved from the RTU log. This defines the sizes of the data packet it should be adjusted for the communications channel capacity                                                                  | 128 KB     |
| Archive Download Auto Retries  | Number of attempts to request a packet if it is stopped before pausing to allow the user to resume or cancel the operation. Adjust this according to the reliability of the comms channel                        | 5 retries  |
| Archive Download Retry Delay   | Delay between each attempt to re-request a packet.                                                                                                                                                               | 5 seconds  |

Data retrieved from the RTU log should be adjusted for the Channel bandwidth use a setting that will effect the transfer quickly without degrading communications between DATRAN and other Sites. The request block size is also modified to suit the relative reliability communications channel (some radio channels can suffer from environmental conditions which effectively increase its channel error rate.

* Suggested Use 128-256 KB over ethernet radio channel
* Suggested Use 256-1024 KB over Fibre channels
* Not recommended over low bandwidth connections less than 100 kbps

Heavily loaded channels (with many RTUs attached) may experience degradation if the request block size is set too high because XL4-Connect will hog the channel at the expense of other RTUs trying to communicate with DATRAN.

## View a downloaded log

1. Click the **Open log file** button and navigate to the location where your log file is stored then select and open it.

Downloaded log files are stored to a folder on your Windows device. XL4-Connect provides a built-in viewing tool to quickly inspect the log that you have downloaded. Timestamps are shown in UTC (as the records are stored). The timestamp, point type and value will be displayed. Typically, the following point types are logged in the RTU and therefore also in the Archive. Real inputs are physical inputs connected to the RTU or they could be values from say a modbus device or PLC. Notional Inputs are typically variables or derived values resulting from a computation in the RTU.

| Point type | Meaning                               |
| ---------- | ------------------------------------- |
| RAI        | Real Analogue input, 16 bit value     |
| RDI        | Real Digital Input, 0 or 1            |
| NAI        | Notional Analogue input, 16 bit value |

Outputs (RAO, NAO, RDO) are rarely if ever required to be logged.
