Data Retention configuration for HM only

Prev Next

πŸ“Š Retention Settings for HM-Only Data Storage

🎯 Objective

The customer requires only Hardware Metrics (HM) data to be retained. All other data types β€” such as functions, raw data, screenshots, and KPIs β€” must be automatically removed based on defined retention settings.


βš™οΈ Related Retention Parameters and Their Effects

Parameter

Description

πŸ–ΌοΈ SCREENSHOTS_RETENTION_DAYS

Defines how long screenshots are stored (e.g. 1 = 1 day). If set to 0, screenshots are processed for image recognition but not stored. Impacts historically stored screenshots. Default: 30.

πŸ“¦ RETENTION_FUNCTIONS_ITEM_DAYS

Specifies how many days Functions Item data is retained. 0 means it is immediately removed. 1 means retained for 1 day. If left empty, data is retained indefinitely. Default: 14.

πŸ“¦ RETENTION_ITEM_DATA_DAYS

Controls how long Item Data is stored. 0 means immediate removal, 1 means kept for 1 day. Empty means retained. Default: 31.

πŸ“¦ RETENTION_RAW_DATA_DAYS

Indicates retention period for unprocessed raw data. 0 means immediate and unrecoverable deletion. 1 keeps data for 1 day. Empty = retained. Default: 31.

πŸ“ˆ RETENTION_HARDWARE_METRICS_DATA_DAYS

Duration for storing Hardware Metrics (Prometheus/VictoriaMetrics). 0 removes all HM data, 1 retains for 1 day. Empty = retained. Default: 31.

⚠️ Warnings:

Setting any of the above to 0 causes immediate deletion of respective data.

Negative values should only be used for deleting KPI aggregates (WEEKLY, MONTHLY).

DO NOT set RETENTION_FUNCTIONS_ITEM_DAYS, RETENTION_ITEM_DATA_DAYS, or RETENTION_RAW_DATA_DAYS to negative values β€” it will cause errors.

πŸ”Info:

All the retention parameters are described in the Special settings article


πŸ› οΈ Recommended Configuration

Frequent Cleanup via Cron

  • ⏱️ Set up a cron job to remove non-HM data every 10 minutes.

  • πŸ” Ensures quick turnover and aligns with the requirement to retain HM only.

πŸ“‹ Pipelines to be cleaned up

  • kpi-pipeline

  • rawdata-pipeline

  • process-pipeline

πŸ“Œ Behaviour Validation

  • βœ… HM data is retained and displayed properly on frontend.

  • ❌ Screenshots are not stored (SCREENSHOTS_RETENTION_DAYS = 0).

  • ♻️ Functions and raw data are cleared every 10 minutes.

  • 🧹 KPI data (HOURLY + DAILY) is removed daily via cron.


βœ… Final Configuration Summary

The final configuration ensures that only essential Hardware Metrics (HM) data is retained, while all non-HM data (functions, raw data, screenshots, and KPI aggregates) is regularly cleaned up using retention settings and scheduled cron jobs. This approach:

  • βœ… Meets the customer’s requirement to retain HM only

  • 🧹 Minimizes data storage and system load by removing unnecessary data quickly

  • πŸ› οΈ Prevents errors by using valid retention values (0 instead of negative) for non-aggregate data

  • πŸ” Keeps the system clean and efficient with a 10-minute cleanup cycle

Overall, it balances system performance with compliance to data retention policies.

Parameter

Value

Notes

πŸ–ΌοΈ SCREENSHOTS_RETENTION_DAYS

0

No screenshots stored

πŸ“¦ RETENTION_FUNCTIONS_ITEM_DAYS

0

Cleared every 10 mins via cron

πŸ“¦ RETENTION_ITEM_DATA_DAYS

0

Cleared every 10 mins via cron

πŸ“¦ RETENTION_RAW_DATA_DAYS

0

Cleared every 10 mins via cron

πŸ—ƒοΈ HM Retention

31

βœ… Retained and displayed correctly


FAQ

What is a β€œCron” job?

A cron job is a scheduled task that runs automatically at specified intervals on Unix-like operating systems (such as Linux). It uses a service called cron to execute commands, scripts, or programs at fixed times, dates, or intervals.

What if I leave a retention parameter empty?

If a parameter is left empty or not set, the data will be retained indefinitely by default. Each parameter also has a system-defined default (e.g., 14 or 31 days).

Is HM data ever deleted automatically?

Only if RETENTION_HARDWARE_METRICS_DATA_DAYS is set to 0 or another finite number.

Default is 31 days. If set to empty, HM data is retained indefinitely.