Resolving WinCC Flexible Datalog Archive Errors on MP277 Panels

David Krause13 min read
SiemensTroubleshootingWinCC
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

Resolving WinCC Flexible Datalog Archive Errors on MP277 Panels

This technical reference addresses the most common WinCC Flexible datalog and archiving failures observed on the SIMATIC MP277 HMI panel: corrupted segmented circular logs, the recurring system alarm 80045, the network-side error 59 during backup copy, and the documented MP277 entry-count ceiling. It consolidates field-proven configuration limits, script function reference, and step-by-step recovery procedures suitable for commissioning engineers and maintenance technicians.

Scope: Targets WinCC Flexible 2008 SP2/SP3/SP5 projects running on MP277 8" and 10" Touch/Key devices with Windows CE 5.0. Limits, system events, and script function names are not transferable to TIA Portal WinCC Comfort/Advanced without verification against the corresponding TIA manual set.

1. MP277 Datalog System Limits

The MP277 panel enforces hard limits on datalog size and project archive count. Exceeding these limits produces silent truncation, write failures, or repeated system alarms during runtime. The limits are documented in the WinCC Flexible help system under "System Limits" and in the SIMATIC HMI Manual Collection.

Table 1 — MP277 Datalog and Archive Limits
Parameter MP277 Limit Source
Maximum number of data logs per project 20 WinCC Flexible Help — System Limits
Maximum entries per data log (sum of all segments) 10,000 WinCC Flexible Help — System Limits
Recommended entries per circular log (field practice) 5,000 Field engineering consensus
Number of segments in a segmented circular log Up to 200 segments WinCC Flexible Help
File format on internal flash / external storage CSV (semicolon delimited), RDB-compact when logged via tags WinCC Flexible Runtime
Storage location options \Storage Card\Logs, \USB\Logs, network share via SMB MP277 Operating Instructions

The 10,000-entry ceiling applies to the total entries across every segment of a segmented circular log, not per segment. If the datalog is configured as a non-segmented circular log, the entire 10,000-entry budget is consumed by a single file. A 10-second acquisition rate at 10,000 entries yields roughly 27.7 hours of continuous history before wraparound; this is the practical limit when the application must survive an overnight plant outage without backup.

Critical: The 10,000-entry limit is enforced by Runtime once the file is opened for write. If the configured maximum exceeds this value, Runtime clamps it to 10,000 and writes a system alarm at first overflow. Always size the segment count × entries-per-segment to remain ≤ 10,000.

2. Datalog Configuration in WinCC Flexible

A WinCC Flexible datalog is a sequence-based file written to the panel's file system. Each log has a storage location, an entry schema (tag list), a cycle or trigger, and a size policy (circular or sequential; segmented or non-segmented).

2.1 Recommended Configuration for a Temperature Log

  1. Open the project in WinCC Flexible 2008 and select Logs > Data Logs.
  2. Create a new log named Temperature.
  3. Add a single tag column of type REAL or INT matching the PLC address (e.g., DB1.DBD0).
  4. Set Logging mode to Circular log.
  5. Enable Segmented log with 2 segments × 5,000 entries each (10,000 total, within limit).
  6. Set the Acquisition cycle to 1 second for trend fidelity; let the Logging cycle be 10 seconds to reduce file I/O.
  7. Bind the log to a Trend View for operator visualization.
  8. Configure a tag trigger to start/stop logging on a process condition (e.g., line running).

2.2 Acquisition vs. Logging Cycle

Many integrators conflate acquisition and logging. The Acquisition cycle determines how often Runtime samples the tag value into a buffer; the Logging cycle determines how often the buffered value is committed to the log file. For a temperature signal, a 1 s acquisition with 10 s logging is sufficient for trend review and reduces flash wear by a factor of 10. When the logging cycle exceeds the acquisition cycle, Runtime writes the most recently acquired value to the log.

3. The ArchiveLogFile Function

The ArchiveLogFile function moves (or copies, depending on parameters) a closed log segment from the panel's local storage to a backup location such as a network share, USB drive, or SD card. It is invoked from a script and is the most common failure point when the log exceeds runtime limits.

3.1 Function Prototype

Syntax
  ArchiveLogFile <ArchiveName>, <LogName> [, <DestinationPath> [, <FunctionCode>]]

Parameters
  ArchiveName  : STRING  - Internal archive name declared under "Logs > Logs" in the project.
  LogName      : STRING  - Name of the log file (without path) to archive.
  DestinationPath : STRING - Target directory. UNC paths supported: \\Server\Share\Folder.
  FunctionCode : INT (optional)
                 0 = Copy  (default; source file remains)
                 1 = Move  (source file deleted after successful copy)

Return value
  0            : Success
  <> 0        : Error — Runtime emits system event 80045

3.2 Sample Script: Move Temperature Log on Trigger

' VB script scheduled daily at 23:59:59
Dim hmiDataLog, hmiMove, sResult
hmiDataLog  = "Temperature"             ' Log name as defined in project
hmiMove     = 1                          ' 1 = move (delete source after copy)
sResult     = ArchiveLogFile("hmiDataLog", hmiDataLog, "\\BackupNAS\PlantLogs\Temperature", hmiMove)

If sResult <> 0 Then
    ' Trigger user-defined event for SCADA notification
    SetBit("DB_Alarm.ArchiveError", 1)
End If
Argument order is positional: ArchiveName first, LogName second. Reversing them is the single most common scripting mistake and produces silent failure with system event 80045.

4. System Event 80045 — Diagnosis and Resolution

System event 80045 ("Archiving of log <name> was not successful") is the panel's generic alarm for any ArchiveLogFile failure. It carries no detail on root cause; engineers must work the troubleshooting matrix below before assuming a network fault.

Table 2 — 80045 Root-Cause Matrix
Suspected Cause Verification Resolution
Argument order reversed in script Compare call against prototype in Section 3.1 Correct positional arguments
Source log file still open by Runtime Open log view; check that segment is closed (older segment is not current) Force segment close by waiting for next segment transition, or use a scheduled job timed to off-shift
Corrupted log file from interrupted write Inspect file size anomaly; check for 0-byte or partial files in log directory Delete corrupted file, stop Runtime, restart Runtime
Destination path unreachable Ping server from panel service menu; verify UNC path Restore network connectivity; map path with explicit credentials
Insufficient write permission on share Test with Windows Explorer-equivalent: copy a small text file to same share Grant Modify (not Read) permission to panel service account
File size exceeds SMB buffer / share limit Check file size; if > 200 KB, error 59 may follow (see Section 5) Reduce segment entries or increase log rollover frequency
Multiple ArchiveLogFile jobs racing for same file Inspect scheduler; ensure no two triggers fire within 60 s for same log Stagger triggers; serialize with a single job queue tag
Anti-virus or backup software locking destination Temporarily disable AV on share; retry Add exception for log directory on AV server

4.1 Recovery Procedure for Repeated 80045

  1. Stop WinCC Flexible Runtime on the MP277 from the panel's service menu (Start > Settings > Control Panel > Transfer or via RT_OFF script).
  2. Connect to the panel via ProSave or Ethernet and open the file system.
  3. Navigate to \Storage Card\Logs\Temperature\ (or wherever the log is configured).
  4. Delete the suspect log file(s). If two extra files appear (recovery markers), delete them as well.
  5. Verify the destination share is reachable and writable; create a 1 KB test file from the panel using FileWrite in a diagnostic script.
  6. Restart Runtime and trigger the archive script manually.
  7. Monitor the system alarm window for 30 minutes; if 80045 does not recur, the file was corrupt.
Field evidence: After 2–3 days of clean operation, the corruption often returns if the underlying cause (size, network instability, or trigger collision) is not addressed. Always resolve the root cause; do not stop at file deletion.

5. Network Error 59 — File-Size Triggered Archive Failure

When the log segment grows large — typically beyond 200–300 KB at 10 s logging over 24+ hours — SMB transfers to certain NAS devices (Western Digital My Book / My Cloud series is a confirmed offender) begin to fail with Error 59: An Unexpected Network Error Has Occurred. The MP277's CE 5.0 TCP/IP stack has a small default SMB session buffer; large single-file writes stall the session and the server closes the handle.

5.1 Mitigations for Error 59

  1. Cap segment size: Reduce entries per segment to 2,000–3,000. At a 10 s logging cycle, a 2,000-entry segment is roughly 80–120 KB and stays well under the buffer limit.
  2. Increase rollover frequency: Trigger a segment close on shift change or every 4 hours via a scheduled script using CloseAllLogs or by toggling a tag that resets the trigger.
  3. Stage to local USB first: Copy to a USB stick on the panel, then use a host-side script to push files to the NAS. This decouples the panel's SMB from the NAS's SMB implementation.
  4. Use FTP instead of SMB: Configure the NAS for FTP and replace ArchiveLogFile with a manual FileCopy to an FTP-mapped local path. Verify the panel's FTP client is enabled in the image.
  5. Update NAS firmware: Vendor firmware updates frequently address SMB session timeout issues. Pin the firmware version in your change log.

5.2 Sanity-Check Script for Destination Path

' Diagnostic: write a 1 KB file to the destination path; if it fails, the share is unreachable.
Dim sResult, i
i = 0
Do While i < 10
    sResult = FileWrite("\\BackupNAS\PlantLogs\Temperature\ping.txt", "test", 4)
    i = i + 1
Loop
If sResult <> 0 Then
    SetBit("DB_Diag.NAS_Unreachable", 1)
End If

6. Segmented Circular Log Design Pattern

The segmented circular log is the only sustainable long-term logging topology on MP277. A non-segmented circular log fills to 10,000 entries, wraps in place, and offers no per-segment file the archiver can move. A non-circular (sequential) log fills the file system and never wraps, eventually halting writes. The segmented circular log combines bounded disk usage with discrete archive units.

6.1 Sizing Formula

Total history time  =  (EntriesPerSegment × NumberOfSegments × LoggingCycle) / 1
Example (10 s cycle, 5 segments × 2,000 entries):
                    =  2,000 × 5 × 10 s = 100,000 s ≈ 27.8 h

Disk footprint      ≈  EntriesPerSegment × NumberOfSegments × RowBytes
Example (REAL tag, ~24 bytes/row CSV):
                    ≈  2,000 × 5 × 24 B = 240 KB

6.2 Recommended Settings for Temperature Logging

Table 3 — Reference Configuration: Temperature Datalog
Parameter Value Rationale
Logging mode Circular, segmented Wraparound, archivable units
Segments 5 5 days × 5 h per segment @ 10 s
Entries per segment 2,000 ~80 KB per file, safe under SMB buffer
Total entries 10,000 At MP277 ceiling
Acquisition cycle 1 s Smooth trend display
Logging cycle 10 s Reduces file I/O by 10×
Archive trigger Daily 23:59:59 Off-shift, low operator activity
Archive function code 1 (Move) Prevents duplicate archive writes
Archive destination \\BackupNAS\PlantLogs\Temperature UNC path, Modify permission

7. Long-Term Archiving Strategy

For retention beyond the on-panel 27-hour window, the project must include scheduled archive jobs that copy each closed segment to durable storage. The official Siemens reference document for long-term logging with WinCC flexible describes a project structure that pairs the on-panel Data_Logs_Trend_View log with an external file system for persistence.

Reference: How do you do long-term logging with WinCC flexible? (Siemens Support, PDF)

7.1 Recommended Project Architecture

  1. Define the on-panel log as a segmented circular log (Section 6).
  2. Schedule a daily ArchiveLogFile job for each log to copy closed segments to a NAS share.
  3. On the SCADA host, schedule a PowerShell or batch script that ingests new CSV files into a SQL database or historian.
  4. Maintain a 30-day retention policy on the NAS with automatic cleanup of files older than 30 days.
  5. For TIA Portal migration, use a viewer tool such as WinCCflexLogViewer to validate archive continuity before cutover.

8. Common Scripting Errors and Their Signatures

Table 4 — Scripting Defects and Diagnostic Signatures
Defect Runtime Signature Detection
ArchiveName and LogName swapped 80045 every cycle; no destination file created Print arguments in a debug message before call
Hard-coded backslash in path 80045; SMB error 53 (path not found) Use forward slashes or doubled backslashes in strings
Trailing backslash in destination 80045 sporadically; file created with empty name Strip trailing slashes from destination path
FunctionCode omitted (defaults to 0 = copy) Archive grows on panel; NAS gets duplicates Pass explicit 1 for move; verify panel disk usage
Script called on every tag change Multiple 80045 events per minute Switch to scheduled trigger; debounce with a 60 s tag timer
Destination uses mapped drive (Z:\) instead of UNC 80045 after reboot when mapping lost Always use \\Server\Share paths in production

9. Verification Checklist After Configuration Change

After modifying any datalog, archive script, or destination path, run the following verification sequence before returning the panel to production.

  1. Compile and download the project to the MP277 and restart Runtime.
  2. Confirm the log file appears in \Storage Card\Logs\<LogName>\ after one logging cycle.
  3. Trigger the archive script manually and confirm a file appears at the destination share.
  4. Inspect the destination file with a CSV editor; verify the semicolon-delimited schema matches the tag list.
  5. Force a wraparound by writing 11,000 entries and confirm Runtime clamps to 10,000 without alarm.
  6. Disconnect the network share and re-trigger the script; confirm 80045 fires within one cycle and recovery occurs within 300 s of reconnection.
  7. Reboot the panel; confirm scheduled archive resumes without operator intervention.
  8. Open the log in the Trend View and verify continuous history across the segment boundary.

10. Migration Path to TIA Portal

Projects designed for WinCC Flexible are migrated to TIA Portal WinCC Comfort/Advanced via the porting tool. The datalog structure is preserved, but the script API changes: ArchiveLogFile becomes LogTag with separate archive job configuration under "Historical data > Data logs". The 10,000-entry MP277 limit does not apply to TIA Comfort Panels — TP700 Comfort supports 100,000 entries per log, TP1500 Comfort 500,000. Plan capacity sizing accordingly during migration.

Validate the migrated archive data by exporting one day's CSV from the new TIA project and comparing the row count against the WinCC Flexible source.

11. Summary of Hard Constraints

Table 5 — Non-Negotiable Constraints for MP277 Logging
Constraint Value
Max data logs per project 20
Max entries per log (all segments) 10,000
Recommended entries per log (field practice) 5,000
Max segments per segmented log 200 (impractical; use 2–5)
Archive file size threshold (SMB safety) ≤ 200 KB
Archive error retry interval (Runtime default) 300 s
Archive function argument order ArchiveName, LogName, Path, Code

Compliance with these constraints prevents 80045, error 59, file corruption, and silent data loss. When the application demands retention beyond the MP277 ceiling, externalize the archive job to a host-based historian and use the panel only as a real-time trending surface.

What is the maximum number of entries in a WinCC Flexible datalog on an MP277?

The hard ceiling is 10,000 entries per log, summed across all segments of a segmented circular log. Field practice recommends staying at or below 5,000 entries to leave headroom for write bursts and to keep segment file sizes under 200 KB for safe SMB transfer.

What does system event 80045 mean and how is it cleared?

Event 80045 ("Archiving of log <name> was not successful") is Runtime's generic alarm for any ArchiveLogFile failure. It does not specify the cause. Clear it by resolving the underlying issue from the root-cause matrix in Section 4 — most commonly reversed script arguments, an unreachable destination share, a corrupted source file, or insufficient write permission — then re-trigger the archive manually.

Why does my MP277 show Error 59 when copying a large log file to a NAS?

Error 59 ("An Unexpected Network Error Has Occurred") fires when the log file exceeds the MP277's SMB session buffer, typically beyond 200–300 KB. Certain NAS firmware versions (notably Western Digital My Book / My Cloud) drop the session under this load. Reduce entries per segment to 2,000, stage to a local USB drive, or switch the destination to FTP.

How many data logs can one MP277 project contain?

Up to 20 data logs per project. Each log's entries count independently against the 10,000-entry per-log limit, so a fully populated project can hold up to 200,000 entries total before any individual log is capped.

Can a segmented circular log be archived while Runtime is running?

Yes. ArchiveLogFile operates on closed segments only. The currently active segment cannot be moved or copied until Runtime rolls it over to a new segment, which happens automatically when the entries-per-segment limit is reached or when the log trigger is reset. Schedule the archive job to fire after the expected rollover to avoid 80045 caused by attempting to archive an open segment.

Back to blog