Restoring WinCC Unified Panel Logs from Backup Path (V19/V20)

David Krause10 min read
HMI / SCADASiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

1. Overview: WinCC Unified Panel Logging Architecture

The Siemens SIMATIC WinCC Unified runtime on Unified Comfort Panels stores process values, alarms, and audit entries inside embedded SQLite databases. On Unified Comfort Panels (e.g., MTP 1500 Unified Comfort PRO), the runtime writes log segments under /home/industrial/... on the internal flash or, when provisioned, on an externally mounted SD card / system card. Log segments rotate automatically based on segment size and time, and on each rotation the closed segment is sealed.

When Backup mode is configured to Path, the runtime copies the sealed segments to a user-defined folder on the mounted storage device, suffixing the files with .bak so the active working database is never overwritten. This is the canonical mechanism for surviving SD-card replacement, panel swap, or image restore.

Field rule: Without a configured Backup Path, log segments live only inside the active runtime working directory. A card swap or factory reset deletes them. Configure a backup path before commissioning.

2. Supported Log Types and Their SQLite Storage

Three log categories are relevant for Unified Panels. All three share the same SQLite-based segment rotation model and the same backup-path mechanism, but each has a different schema and restore semantics.

Log Type Purpose Database File (default) Backup Suffix
Data log Process value archive (tags, time-stamped samples) <ProjectName>_<LogName>.db .bak
Alarm log Operator and process alarm history <ProjectName>_Alarms.db .bak
Audit Trail FDA-style operator action traceability AuditTrail.db (single DB, named segments) .bak

The audit database differs in that it is a single logical database that is split internally into time-bounded segments; backup files therefore map 1:1 to those audit segments. Data and alarm logs can each contain multiple user-defined logging tags; the runtime creates one physical database per log tag object.

3. Configuring Backup Mode = Path

Path-mode backup is set per log inside the TIA Portal project tree.

  1. In the TIA Portal project, open Logs in the project tree.
  2. Select the log (data log, alarm log, or Audit Trail).
  3. In the Inspector window choose Properties > General > Backup.
  4. Set Backup mode to Path.
  5. Specify the absolute target folder on the runtime storage (e.g., /media/sdcard/backup or /home/industrial/Backup/Logs).
  6. Compile and download the project to the Unified Panel.

The official procedure is documented in the TIA Portal V20 Unified Audit readme.

Path semantics: The "Path" mode means the runtime copies closed segments to the specified path rather than mirroring them as a network share (SMB) or RPC target. Verify the panel user account has write permission on the path; otherwise backups silently fail and only the working copy remains.

4. Backup File Naming and Layout

When the runtime rotates a segment, it performs the following on the storage:

  1. Closes the working SQLite database.
  2. Copies the closed database to the configured Backup Path.
  3. Appends the .bak extension to the copy in the Backup Path; the working copy retains its .db extension.
  4. Continues logging into a fresh working database.

Resulting files in the Backup Path look like:

/media/sdcard/backup/
  ProjectX_TagArchive_Flow.db.bak
  ProjectX_TagArchive_Pressure.db.bak
  ProjectX_Alarms.db.bak
  AuditTrail_2024-11-15_08-00.db.bak
  AuditTrail_2024-11-16_08-00.db.bak

The presence of .bak files confirms the path-mode backup is operating correctly. Absence of .bak files after a rotation cycle indicates a misconfiguration or a permission error.

5. Restore Methods by Runtime Type and Firmware

Restore capability differs sharply between WinCC Unified PC Runtime and the Unified Comfort Panel runtime. The version of TIA Portal / panel firmware also gates which system functions are exposed.

Runtime / Firmware Restore via System Function Restore via Trend/Audit Control Manual SQLite
PC Runtime (V17 and later) Yes Yes Yes
Unified Panel V19 No (planned) No Possible, unsupported
Unified Panel V20 (base) No (planned) Limited Possible, unsupported
Unified Panel V20 Update 2 No (planned) Yes (trend displays backup content) Possible, unsupported
Unified Panel V20 Update 3 Yes (Audit via HMIRuntime.Audit) Yes Possible, unsupported

The progression above is documented across the TIA Portal V20 Update 3 readme for backup/restore of logs, which introduced the new system functions for backing up and restoring log segments using scripts.

6. RestoreAuditLog System Function (RT Unified)

The RestoreAuditLog system function restores the log segments of the backup of an Audit log so the restored data can be used in Runtime and visualized in a control.

Function reference (from the RestoreAuditLog RT Unified manual page):

Parameter Type Description
Source String / WString Path and name of the backup file to be restored (the .bak file).
LogName String / WString Name of the Audit log to which the segments will be restored.
Result Output Returns success / error code.

Example JavaScript call from a button or scheduled task on the runtime:

// Restore a specific Audit backup segment
let source = "/media/sdcard/backup/AuditTrail_2024-11-15_08-00.db.bak";
let result = await HMIRuntime.Audit.RestoreAuditLog(source, "AuditTrail");

if (result && result.ErrorCode === 0) {
    HMIRuntime.Trace("RestoreAuditLog OK");
} else {
    HMIRuntime.Trace("RestoreAuditLog failed: " + JSON.stringify(result));
}
Availability: Confirm that the panel firmware is on V20 Update 3 or later before binding the script. On V19 / V20 base, the call returns an "unknown function" error and the runtime does not log it as a fault.

7. Backup / Restore System Functions in V20 Update 3

The TIA Portal V20 Update 3 readme introduces new system functions to back up log segments and to restore backed-up segments using scripts. They are async and accessible via the JavaScript runtime object:

// Async backup of a log segment
await HMIRuntime.Logs.Backup("DataLog_Flow", "/media/sdcard/backup");

// Async restore of a log segment
await HMIRuntime.Logs.Restore("/media/sdcard/backup/DataLog_Flow_2024-11-15.db.bak", "DataLog_Flow");

// Audit backup / restore
await HMIRuntime.Audit.Backup("AuditTrail", "/media/sdcard/backup");
await HMIRuntime.Audit.RestoreAuditLog(sourcePath, "AuditTrail");

These calls return a Promise; always await them and inspect the returned object for ErrorCode and ErrorString. Surface the result on a status tag so commissioning engineers can verify the operation without attaching a debugger.

8. Manual SQLite Restoration Procedure (Unsupported)

On firmware versions where the system functions are not available, the only path is direct SQLite manipulation. This is not documented by Siemens and should be used only when no official tool exists.

  1. Stop the WinCC Unified Runtime on the panel (Control Panel > Runtime > Stop).
  2. Copy the relevant .bak file from the Backup Path to a workstation.
  3. Rename the file from .db.bak to .db so SQLite tools accept it.
  4. Open the file with sqlite3 or DB Browser for SQLite.
  5. Inspect the schema: tables are named Logging, Alarms, AuditTrail, with columns Timestamp, Name, Value, Quality, etc.
  6. Export the desired window with .mode csv and .output restore.csv; or build an SQL query that filters the time range.
  7. If the goal is to re-import into the live runtime, concatenate rows into a fresh database with the same schema and place it under the runtime working directory before restarting Runtime. Do not overwrite an active .db; the runtime holds it open with an exclusive lock.
Risk: The internal schema is not published. Column names, partitioning, and indexing differ between V19 and V20 and may differ again in Update 2 / Update 3. Treat any manual restore as best-effort and always keep the original .bak intact.

9. Audit Trail Specifics

Audit Trail differs from data and alarm logs in three ways:

  • Single logical DB, multiple segments. All audit entries live in AuditTrail.db, partitioned by time into closed segments. Each segment is backed up individually.
  • Tamper-evident. Audit entries are write-once in the sense that closed segments are sealed; manual SQLite edits invalidate compliance.
  • GMP/FDA-relevant. Use the official RestoreAuditLog path wherever regulatory traceability matters; do not author manual SQLite scripts in GxP environments.

The configuration of the Audit Trail backup path is described in Audit - WinCC Unified (TIA Portal V20 readme).

10. Restoring After Memory Card Replacement

Typical scenario: the operator replaces the SD card on an MTP 1500 Unified Comfort PRO after a hardware fault, or installs a brand-new card on a spare panel. Use the following checklist.

  1. Insert the card and verify the mount path (Control Panel > System > Storage).
  2. Recreate the Backup Path folder structure if missing (e.g., /media/sdcard/backup).
  3. Restore the project from a TIA Portal project backup (.zap) to the panel.
  4. Place the historical .bak files into the Backup Path. The runtime does not auto-import them; it only writes new rotations to that path.
  5. If V20 Update 3 or later is installed, use HMIRuntime.Logs.Restore and HMIRuntime.Audit.RestoreAuditLog from a startup script to re-import the segments into the working databases.
  6. If V20 Update 2 only is installed, open a Trend Control or Audit Viewer control and load the backup file directly into the visualization to read the historical data.
  7. If V19 / V20 base only is installed, use the manual SQLite procedure in Section 8 to extract and re-import.
  8. Confirm by opening a trend on a known historical timestamp; the curve must render without "no data" gaps.

11. Verification Checklist

After any restore, verify the following before signing off the panel:

  • Trend Control renders the restored time range without #QUALITY_BAD tags.
  • Alarm Control shows historical alarms with the original TimeRaised / TimeCleared values.
  • Audit Viewer shows operator actions with continuous, monotonically increasing IDs (no gaps introduced).
  • Storage usage on the SD card matches expectations (the runtime appends, not overwrites).
  • A new log segment rotates within the configured size/time window and creates a new .bak file in the Backup Path.

12. Troubleshooting Matrix

Symptom Likely Cause Action
.bak files never appear Backup mode is not Path, or path is unwritable Re-check Properties > General > Backup; verify runtime user permissions
Restore function returns "unknown function" Panel firmware pre-dates the function (V19, V20 base) Upgrade to V20 Update 3 or use V20 Update 2 trend display
Restore returns ErrorCode -1 / SQLITE_BUSY Runtime still holds the active .db exclusively Stop Runtime before placing the restored file in the working directory
Restored trend shows gaps Wrong log name passed or schema mismatch after firmware upgrade Match the LogName string exactly to the project tree identifier
Audit Viewer shows no restored entries Segment was for a different Audit log name Inspect AuditTrail table for the correct logical log name
SQLite manipulation corrupts active database File was overwritten while Runtime was running Always stop Runtime before swapping files; keep a copy of the original .bak
Card swap loses audit history No Backup Path configured or Backup Path was on the same card Configure a Backup Path on a separate storage target and replicate off-box

13. Field-Proven Best Practices

  • Use a separate SD card or USB target for the Backup Path so a card failure does not destroy both working and backup copies.
  • Bind a startup script that copies the most recent .bak files to an FTP/SMB share on each rotation, if the network allows it.
  • Add a tag BackupLastSuccess updated by a script that watches the Backup Path mtime and raises an alarm when no new .bak appears within the expected rotation window.
  • Document the exact panel firmware version in the project header; restore behavior changes between V19, V20, V20 Update 2, and V20 Update 3.
  • Treat the official RestoreAuditLog and HMIRuntime.Logs.Restore paths as the only validated method for GxP-relevant audit data.

Can I restore WinCC Unified Panel logs from a .bak backup file on V19?

No official restore function is exposed on Unified Panels running V19. Use direct SQLite inspection on a workstation to export the data, or upgrade to V20 Update 3 where the new HMIRuntime.Audit and HMIRuntime.Logs system functions are available.

Which firmware version allows a trend control to display a backup file directly?

V20 Update 2 introduces the ability for a trend control to display the contents of a backup file on Unified Panels, as documented in the TIA Portal V20 Update readme.

How does the RestoreAuditLog system function work in WinCC Unified?

RestoreAuditLog takes the path of an Audit backup .bak file and the target Audit log name, restores the segments into Runtime, and returns a result object with ErrorCode. It is documented at the official RestoreAuditLog RT Unified page and is exposed via HMIRuntime.Audit in V20 Update 3 and later.

Where do I configure the Backup Path for Audit Trail in TIA Portal?

In the project tree, double-click Logs, then Audit Trail, then Inspector > Properties > General > Backup. Set Backup mode to Path and specify the absolute runtime folder. See the Audit - WinCC Unified V20 readme for the official procedure.

Is WinCC Unified PC Runtime restore different from the panel restore?

Yes. Restoring log segments from backup files has been available on WinCC Unified PC Runtime since the original release, while on Unified Panels the corresponding functionality has only been progressively introduced from V20 Update 2 (trend display) through V20 Update 3 (scripted system functions).

Back to blog