# Data Archiving
---
使用者可以使用Data Archiving功能來調整下列兩項設定
- 快速調整object的資料保存時間
- 快速調整每個parameter的recording rate
本文章先介紹Edge365的資料保存時間規則, 以及Recording rate運作方式, 最後說明如何使用Data Archiving功能
## Recording Rate
在Parameter章節中, 我們介紹了Recording Rate的設定, 這邊再詳細說明細節如下:
1. Real-time (RT) Data
- 每個Device上傳的tag的value, Edge365會保存最新的一筆, 在系統的Redis資料庫中
2. RAW Data
- Device上傳的每一筆tag value歷史記錄
- 只有當一個tag被primitive parameter綁定, 並且該parameter開啟Recording Rate > 1 min後, 這個tag才會開始記錄RAWData
3. Recording Rate
- 同Parameter章節介紹, Number / Discrete Parameter的Recording Rate選項包含:
- Do not record (default value)
- 1 min
- 5 min
- 15 min
- 30 min
- 60 min
- String的Recording Rate選項包含:
- Yes
- No (default value)
- 開啟後, 會依據不同的data type, 處理每個Recording Rate要保存的資料內容, 請參閱Parameter章節說明
6. Hour
- 保存的資料格式同Recording Rate, 只是時間區間為1小時一筆
7. Day
- 保存的資料格式同Recording Rate, 只是時間區間為1天一筆
## Days to keep object data
Edge365作為一個公有雲服務, 提供資料庫保存不同租戶上傳的數據, 為了系統穩定考量, 有設定資料保存時間上限, 以確保能盡可能服務更多租戶.
在每個Object的設定中, 需要設定Days to keep object data這個欄位

這個欄位的設定將會影響這個Object的每一個Parameter的資料保留時間, 詳細的規則如下:
#### Edge365 site
- days to keep obj data
- Recording Rate資料的保留時間
- UI預設值7天(7天前的Recording Rate資料會從資料庫中移除)
- 限制最大值731天
- Hour / Day
- UI沒有設定
- Hour / Day保留時間 = 731天
- RAWData
- UI沒有設定
- RAWData保存時間 = days to keep obj data,且最大值=31天
#### Edge365 site, open External blob setting
使用者在自己的tenant下, 設定External blob, 提供他們自己訂閱的blob服務的連線資訊, 則保留時間規則如下:
- days to keep obj data
- Recording Rate資料的保留時間
- UI預設值7天(7天前的Recording Rate資料會從資料庫中移除)
- 無上限
- Hour / Day
- UI沒有設定
- Hour / Day保留時間 = days to keep obj data, 且最小值=731天
- RAWData
- UI沒有設定
- RAWData保存時間 = days to keep obj data, 無上限
## Data archiving
- 快速調整object的資料保存時間
1. 進入一個group, 選擇`Data archiving` tab, 進入後可看到Object list
2. 每個Object都可以調整days to keep object data

3. 調整一個object的days to keep object data, 填寫完畢後按下`✓`

4. 修改完成, 重整頁面可發現已修改

- 快速調整每個parameter的recording rate
1. 在`Data archiving` tab中, 點選一個object

2. 進入該object的parameter list, 並可以看到每個parameter的Recording Rate

3. 勾選全選checkbox, 並選擇1個parameter的recording rate, 可套用到所有"當前頁面"的parameter設定中

4. 按下`Submit`, 完成當前頁面的Recording rate批量設定

5. 確認Data log欄位變為綠色勾勾, 就代表開啟Recording Rata設定完成

# Data Archiving
---
Users can use the Data Archiving feature to adjust the following two settings:
- Quickly adjust the data retention time for objects.
- Quickly adjust the recording rate for each parameter.
This article first introduces the data retention rules and recording rate operation in Edge365. Finally, it explains how to use the Data Archiving feature.
## Data process strategy
In the Parameter section, we have discussed the setting for Recording Rate. Here are the details for parameter data that processed by Edge365:
**1. Real-time (RT) Data**
- Edge365 stores the latest value of each tag uploaded by the device in the system's Redis database.
**2. RAW Data**
- Edge365 records the historical log of each tag value uploaded by the device.
- RAW Data recording only starts when a tag is bound to a primitive parameter and that parameter has a Recording Rate set to greater than 1 minute.
**3. Recording Rate**
- As mentioned in the Parameter section, the Recording Rate options for Number/Discrete Parameters include:
- Do not record (default value)
- 1 min
- 5 min
- 15 min
- 30 min
- 60 min
- The Recording Rate options for String Parameters include:
- Yes
- No (default value)
- Once enabled, the Data Archiving feature handles the data content to be saved based on the data type. Please refer to the Parameter section for more details.
**4. Hour**
- The data format saved is the same as the Recording Rate, but the time interval is one hour per record.
**5. Day**
- The data format saved is the same as the Recording Rate, but the time interval is one day per record.
## Days to Keep Object Data
Edge365 is a public cloud service that stores data uploaded by different tenants. To ensure system stability and serve as many tenants as possible, there is a limit on the data retention time. Each Object's settings require the configuration of the "Days to keep object data" field.

The setting in this field will affect the data retention time for each Parameter of the Object. The detailed rules are as follows:
#### Edge365 Site
- **Days to keep object data:**
- Means the data retention time for Recording Rate data.
- Default value in the UI: 7 days (Recording Rate data older than 7 days will be removed from the database).
- Maximum limit: 731 days.
- **Hour/Day:**
- Not configurable in the UI.
- Retention time for Hour/Day: 731 days.
- **RAW Data:**
- Not configurable in the UI.
- RAW Data retention time: Equals to Days to keep object data, but with a maximum limit of 31 days.
- Example
- Set "Days to keep object data" = 50
- Recording rate data: 50 days
- Hour/Day data: 731 days
- Raw Data: 31 days
#### Edge365 Site with Open External Blob Setting
If users configure an external blob in their own tenant, providing the connection information for their subscribed blob service, the retention rules are as follows:
- **Days to keep object data:**
- Means that data retention time for Recording Rate data.
- Default value in the UI: 7 days (Recording Rate data older than 7 days will be removed from the database).
- No upper limit.
- **Hour/Day:**
- Not configurable in the UI.
- Retention time for Hour/Day: Equals to Days to keep object data, but with a minimum value of 731 days.
- **RAW Data:**
- Not configurable in the UI.
- RAW Data retention time: Equals Days to keep object data, with no upper limit.
- Example
- Set "Days to keep object data" = 50
- Recording rate data: 50 days
- Hour/Day data: 731 days
- Raw Data: 50 days
- Set "Days to keep object data" = 900
- Recording rate data: 900 days
- Hour/Day data: 900 days
- Raw Data: 900 days
## Data Archiving
- Quickly adjust the data retention time for objects
1. Go to a group and select the `Data Archiving` tab. Inside, you will see the Object list.
2. Each Object can have its "Days to keep object data" adjusted.

3. To adjust the "Days to keep object data" for an object, fill in the desired value and click on the `✓` button.

4. After the modification, refresh the page to see the changes.

- Quickly adjust the recording rate for each parameter
1. In the `Data Archiving` tab, click on an object.

2. Inside the object, you can see the parameter list and the Recording Rate for each parameter.

3. Check the "Select All" checkbox and choose a recording rate for one parameter. This setting will be applied to all parameters on the current page.

4. Click "Submit" to complete the batch Recording Rate configuration for the current page.

5. Confirm that the Data Log field shows a green checkmark, indicating that the Recording Rate setting has been enabled.

---
###### tags: `Edge365`
###### #edge365