WinCC Tag Logging: Locating the Archive Database and Exporting to CSV
WinCC does not write tag logging values to comma-separated text files. From the legacy V6.x runtime up through the current WinCC Unified (TIA Portal V20) line, the historian is implemented as a Microsoft SQL Server database. Operators who need a portable artifact for reporting, statistical analysis, or hand-off to MES layers must deliberately export that data to CSV (or Excel). This reference describes exactly where the raw archive lives, which SQL files are touched, the export mechanisms shipped with each major version, and the license and configuration constraints that determine which path is available on a given project.
CC_LoggingFast, CC_LoggingSlow, CC_Environmental) outside the WinCC runtime or its licensed OLE-DB provider is unsupported. Always use the in-built export functions or the WinCC OLE-DB connector (AS-OS Engineering license) to avoid corrupting segments that the runtime is actively writing.1. WinCC Tag Logging Architecture Overview
Tag Logging is split into two acquisition cycles, each persisted in its own SQL Server database:
- Tag Logging Fast – acquisition and archive cycle in the millisecond-to-second range. Used for fast-changing process values (pressures, flows, currents).
- Tag Logging Slow – acquisition and archive cycle in the seconds-to-minutes range. Used for slowly changing values (temperatures, counters, setpoints).
Both databases are created and maintained by the WinCC ArchiveManager service. The runtime writes via SQL Server, segments the tables over time, and rotates the on-disk files. Tag Logging in WinCC V6/V7 is a SQL Server Express or full SQL Server backend; the exact storage location is configurable in the project properties.
2. Where the Archive Files Live (V6 / V7)
The default path is inside the WinCC project directory, under the ArchiveManager subfolder:
C:\Siemens\WinCC\<ProjectName>\ArchiveManager
├── TagLoggingFast\
│ ├── CC_LoggingFast.mdf
│ └── CC_LoggingFast_log.ldf
└── TagLoggingSlow\
├── CC_LoggingSlow.mdf
└── CC_LoggingSlow_log.ldf
| File | Type | Role |
|---|---|---|
CC_LoggingFast.mdf |
Primary data file | Holds the segmented fast-cycle archive tables and their index pages. |
CC_LoggingFast_log.ldf |
Transaction log | SQL Server transaction log for the fast database; necessary for crash recovery. |
CC_LoggingSlow.mdf |
Primary data file | Holds the slow-cycle archive tables. |
CC_LoggingSlow_log.ldf |
Transaction log | Transaction log for the slow database. |
CC_Environmental.mdf |
Primary data file | Created in V7 projects using the Environmental option; stores environmental/system data. |
WINCC \ SQLEXPRESS) holds locks on them. Stop the WinCC runtime (or at least the Archiving subsystem) before manipulating .mdf/.ldf files.3. Verifying the Storage Path in the Project
Confirm the path that the active project is using:
- Open the WinCC Explorer on the engineering or server station.
- Right-click Computer → Properties → Graphics Runtime tab.
- Note the Start picture and the Project path.
- Right-click Tag Logging → Properties (or open the Tag Logging editor).
- Open Archive Configuration → Timelines / Archives. The Storage location and per-archive path fields are shown here; in V7 the path can be redirected to a UNC share.
For a quick check from the command line:
dir /s "C:\Siemens\WinCC\<ProjectName>\ArchiveManager\*.mdf"
dir /s "C:\Siemens\WinCC\<ProjectName>\ArchiveManager\*.ldf"
If you do not see CC_LoggingFast.mdf/CC_LoggingSlow.mdf, the project is using a custom path or the runtime has not yet started archiving. Trigger an acquisition cycle (set a tag with archive=1 and wait one cycle) and re-check.
4. Why You Will Not Find a CSV on Disk
There is no .csv file written by Tag Logging in any version of WinCC. The runtime does the following with a logged tag value:
- Stores the raw value into the in-memory archive buffer of the Tag Logging runtime.
- Flushes the buffer at the configured archive cycle to the SQL segment table for the current time slice.
- Closes and creates new segments as time progresses (segmentation is configured in the Archive Configuration editor).
Anything you can open in a text editor (*.csv, *.txt) must be produced by an explicit export step – either interactively in the operator faceplate, via the WinCC DataMonitor, via the WinCC OLE-DB provider, or via a user-written VBScript/C script in the runtime.
5. Exporting to CSV – Method Matrix
| Method | WinCC Version | Trigger | Output | License |
|---|---|---|---|---|
| OnlineTrendControl right-click → Export Data | V6.2 SP2 and later, V7.x | Operator click in runtime | CSV (per trend window's selected range) | WinCC RT/RC license |
| WinCC DataMonitor (web) | V6.2 SP2+, V7.x | Browser-based download | CSV/XLSX via Trends & Alarms | DataMonitor license |
VBScript (C/C# for V7) with Export on OnlineTrendControl |
V6.x, V7.x | Scheduled / event-driven | CSV at user-defined path | WinCC RT/RC license |
OLE-DB provider WinCC_OLEDBProvider.1 + CC_READTABLE
|
V6.2+, V7.x | External application / script | Any format (consumer-controlled) | WinCC AS-OS Engineering (Connectivity Pack) |
| WinCC Unified: Tag Logging export from a Trend Control | V16+ (Unified, TIA Portal) | Operator click in Unified runtime | CSV/XLSX | Unified RT/RC |
6. Interactive CSV Export from the OnlineTrendControl (V6.2 SP2+)
The fastest path. From WinCC V6.2 SP2 onward, the OnlineTrendControl offers a built-in export:
- Open the WinCC Runtime containing the configured OnlineTrendControl picture.
- Right-click inside the trend window.
- Select Export Data → CSV File (or Export Data… in localized builds).
- In the dialog, set:
- Time range (Start/End – based on the trend's visible time base).
- Columns (the curves currently assigned to the trend control).
- Decimal separator and field separator (comma or semicolon – critical for European locales where Excel expects semicolons).
- Choose the destination path (network share or local).
- Confirm with OK. The runtime writes the CSV and opens it in the associated application.
Resulting file (header depends on curve names and timestamp format):
Timestamp;TagA;TagB;TagC
2024-05-12 08:00:00.000;12.34;0.987;1450
2024-05-12 08:00:01.000;12.36;0.989;1451
; in the export dialog or change the system separator before the export.7. WinCC DataMonitor Export
WinCC DataMonitor is the web-based client for trend and alarm views. On V6.0 SP2 a DataMonitor client can connect and request a CSV export of a trend view. The data path is the same archive; the export is a server-side action.
- Install the DataMonitor server component on the WinCC server (separate installation media in the WinCC setup).
- Activate the DataMonitor web page in the WinCC project (Web Navigator / DataMonitor server settings).
- Open the DataMonitor URL in Internet Explorer/Edge:
http://<WinCCServer>/DataMonitor/ - Log in with a user that has the DataMonitor – View and Export authorization.
- Open Trends & Alarms → Trends.
- Add the archive tags you want to export to a trend view.
- Click Export → CSV. The browser downloads the file.
8. Scripted / Scheduled CSV Export (V6 / V7)
For unattended export – e.g. a daily CSV per shift – use VBScript inside a Global Action or a C action. The OnlineTrendControl exposes an Export method.
Setup prerequisites
- Configure a picture with an OnlineTrendControl bound to the desired archive tags.
- Open the picture in the runtime at least once to instantiate the control (it can be on a hidden start picture).
- Configure a time range;
Exportexports the currently displayed time range.
VBScript example – daily export
' Global action, triggered daily via scheduler
Dim sFile, sRange, oTrend, oTimeRange
Set oTrend = ScreenItems("MyTrendControl")
' Define a 24 h time range ending "now"
Set oTimeRange = CreateObject("TrendTimeRange")
oTimeRange.TimeBase = 1 ' vbSecond = 0, vbMinute = 1, etc.
oTimeRange.Begin = DateAdd("h", -24, Now)
oTimeRange.End = Now
sFile = "D:\Exports\<ProjectName>_" & _
Year(Now) & Right("0" & Month(Now), 2) & _
Right("0" & Day(Now), 2) & ".csv"
oTrend.Export sFile, oTimeRange, 0 ' 0 = CSV
Set oTrend = Nothing
C-script variant (WinCC V7) – use the ExportCSV() method exposed on the IWinCCTrendControl COM interface. See the WinCC V7 Information System under Working with WinCC > VBA for Automated Configuration > Examples > Exporting Data from the WinCC OnlineTrendControl.
\\fileserver\reports\) and grant the WinCC service account modify rights. A relative path is resolved against the WinCC project directory.9. Direct Database Access via the OLE-DB Provider
Power users, Excel Power Query authors, and reporting tools such as SSRS or Power BI connect to the archive using the WinCC OLE-DB provider. This is the only method that does not require the data to be displayed in a picture first.
- Confirm the WinCC AS-OS Engineering (a.k.a. Connectivity Pack) license is installed on the server.
- Build a connection string:
Provider=WinCCOLEDBProvider.1;
Catalog=CC_LoggingSlow_<ProjectName>_<TimeStamp>;
Data Source=.\WinCC;
User Id=<WinCCUser>;
Password=<Password>;
- Use the
CC_READTABLEstored procedure or a directSELECTagainst thedbo.TAGtable (columnVALUE,TIMESTAMP,QUALITY). - Push the result set to CSV from the consumer (e.g.
bcp, Power Query's Export to CSV, or SSRS subscription).
Catalog names follow the pattern CC_<ArchiveType>_<ProjectName>_<YYYY-MM-DD hh-mm-ss-fff>. The catalog is created on first archive start and stays for the lifetime of the project unless explicitly re-created.
WITH (NOLOCK) or set the transaction isolation level to READ UNCOMMITTED in the consumer query, otherwise long-running reports can block the ArchiveManager's writes and cause a back-log of archive segments.10. WinCC Unified (TIA Portal V20) – Logging Tags
From TIA Portal V16 onward, WinCC Unified is the new generation runtime. Tag Logging is configured in the HMI Tags editor of the Unified device, under Logging. The runtime persists values to a built-in SQLite or PostgreSQL store (project- and version-dependent). The Configuring logging tags (RT Unified) – TIA Portal V20 documentation describes the editor, the compression options, and the export from a trend control.
Key differences versus classic V6/V7:
- Logging tags are configured in the project tree under Runtime settings > Logging; there is no separate Tag Logging editor in Explorer.
- Cascading logging tags (a logging tag whose Source is another logging tag via the Compression setting) become invalid after certain project modifications and must be re-defined. The TIA Portal V20 documentation explicitly notes: "If you are using cascading logging tags by having defined a source under 'Compression', the reference becomes invalid due to the copy process. Redefine the [source]."
- Export is done from the Unified Trend Control: right-click → Export data → CSV/XLSX.
- The underlying database is not exposed by default; for external reads use the Unified OLE-DB / OPC UA Historical Access interface.
11. License Requirements Summary
| Capability | Required License |
|---|---|
| Run Tag Logging (write to the SQL archive) | WinCC RT / RC (basic or specific count) |
| Operator CSV export from OnlineTrendControl | WinCC RT / RC |
| Scripted export via VBScript/C | WinCC RT / RC |
| DataMonitor read + CSV export (web) | DataMonitor license on the server |
| OLE-DB direct access / external reporting | AS-OS Engineering (Connectivity Pack) |
| OPC UA Historical Access to archive | OPC UA Server license, plus AS-OS for unrestricted query |
12. Troubleshooting Matrix
| Symptom | Likely Cause | Corrective Action |
|---|---|---|
No *.mdf files in ArchiveManager
|
Runtime never started, or archive path redirected via Project Properties > Archive Configuration
|
Check the configured path; start the runtime and wait one cycle; re-export from the editor |
| Files exist but the slow/fast DB size does not grow | No archive tags configured, or all archive flags are off | Open Tag Logging, check the Archive column for the tags; ensure a process value is being driven |
| CSV export button greyed out | Missing DataMonitor license, or user lacks the Export CSV authorization in User Administrator | Install / assign the DataMonitor license, or grant the user Authorization 7 – Archive export |
| CSV opens in Excel with one column | Field separator collides with decimal separator on locales that use comma | Force separator to ; in the export dialog, or change the Windows regional decimal symbol to . for the export user |
| OLE-DB error "No license for Connectivity Pack" | AS-OS Engineering license missing on the WinCC server | Install the license via Automation License Manager and restart the WinCC CCAgent service |
| Runtime reports "Database full" / "Segment error" | Hard drive full, or path no longer accessible (UNC share dropped) | Check disk space; verify the network path; reconfigure the archive path if the share is permanently unavailable |
| Unified: compressed logging tag shows "---" | Cascading source reference broken after copy / import | Open the logging tag, re-select the Source under Compression, recompile and download |
| Export is empty for a time range | Time range falls into a segment that was already swapped out, or the archive was reset | Open the Time Range dialog in the editor; confirm the segments exist for the requested window |
13. Field-Proven Best Practices
-
Pin your archive path. Always redirect Tag Logging to a dedicated, excluded-from-antivirus volume. Real-time virus scanning of
.mdf/.ldffiles can stall archive writes and corrupt the transaction log. -
Configure segmentation. Default behaviour keeps a single growing segment per archive; on long-running projects this produces huge
.mdffiles. Set a segment size (e.g. weekly or 200 MB) to keep individual files manageable and to make CSV exports bounded. -
Back up the archive periodically. The ArchiveManager is a live SQL Server. Use the SQL Server Agent job (or a script calling
BACKUP DATABASE) to take a daily differential. A copy of the.mdfalone is not a recoverable backup without the.ldf. -
Standardize the CSV schema. Document the column order and the timestamp format (always use ISO 8601,
yyyy-MM-dd HH:mm:ss.fff) in the export script. Consumers (Power BI, Python pandas) parse ISO 8601 without locale settings. -
Author VBScript exports with a fallback path. If
CreateObject("TrendTimeRange")fails on a non-default browser station, the export silently produces an empty file. Wrap the call inOn Error Resume Nextand write an error line into the CSV. -
Use the OLE-DB provider for big exports. For ranges longer than 24 h, the OnlineTrendControl export runs out of memory. Stream from the OLE-DB provider with a chunked
SELECT TOP nloop instead.
14. Quick Reference – File Locations by WinCC Version
| Version | Default archive path | Database engine | Interactive CSV export from trend |
|---|---|---|---|
| WinCC V6.0 / V6.0 SP2 | <Project>\ArchiveManager\TagLogging(Fast|Slow)\CC_Logging*.mdf |
MSDE / SQL Server 2000 | Not built-in (use DataMonitor or VBScript) |
| WinCC V6.2 SP2+ | Same path; configurable | SQL Server 2005 | Yes (right-click → Export Data) |
| WinCC V7.0 / V7.2 / V7.3 / V7.4 / V7.5 | Same path; configurable to UNC | SQL Server 2008/2012/2014/2016/2019 | Yes |
| WinCC Professional (TIA) | Project-relative, configurable | SQL Server Express | Yes (Trend Control → Export) |
| WinCC Unified V16 – V20 (TIA) | Internal store; not directly browsable | SQLite or PostgreSQL (version-dependent) | Yes (Unified Trend Control → Export) |
15. Verification Checklist
After configuring a CSV export, run this checklist on the operator station:
- Trigger the export and confirm the file appears at the configured path.
- Open the CSV in Notepad – confirm the expected header and the locale-correct separator.
- Open the CSV in Excel – confirm the columns parse into separate cells.
- Compare the row count against the SQL source:
SELECT COUNT(*) FROM dbo.<ArchiveTable>. They must match within one segment boundary. - Verify the timestamp column is in ISO 8601 form (or matches the documented export format).
- If scripted: open the WinCC Global Script diagnostics and confirm no
Runtime errorline was logged. - On a Unified station: recompile, download, and re-run the export to rule out the broken-cascading-source case.
FAQ
Where does WinCC store tag logging data – is there a .csv file?
No. WinCC stores tag logging in Microsoft SQL Server databases: CC_LoggingFast.mdf / CC_LoggingFast_log.ldf and CC_LoggingSlow.mdf / CC_LoggingSlow_log.ldf. By default they live in <ProjectPath>\ArchiveManager\TagLoggingFast\ and ...\TagLoggingSlow\. CSV must be produced by an explicit export step.
How do I export a WinCC tag archive to CSV from the runtime?
In WinCC V6.2 SP2 and later, right-click inside an OnlineTrendControl in the running picture and choose Export Data → CSV. Set the time range, columns, and field separator (use ; on European locales). The file is written to the path you choose and opened in the default application.
Can I export to CSV from WinCC DataMonitor on V6.0 SP2?
Yes. Install the DataMonitor server component, activate the DataMonitor web page in the project, log in at http://<WinCCServer>/DataMonitor/, open Trends & Alarms → Trends, configure a trend view, and click Export → CSV. A valid DataMonitor license is required on the server.
How can I script a daily CSV export from WinCC Tag Logging?
Configure a picture with an OnlineTrendControl, then write a Global Action in VBScript that calls the control's Export method with a TrendTimeRange object (e.g. last 24 h). Trigger the action from the WinCC scheduler. The runtime writes the CSV to the path passed to Export.
Why does a Unified logging tag show "No valid value" after copying the device?
The TIA Portal V20 documentation notes that cascading logging tags – those with a Source set under Compression – lose their source reference when the device is copied or when tags are imported from a library. Open the logging tag, re-select the source under Compression > Source, recompile, and download to the runtime.