Troubleshooting
Why the IncuityDiagnostics LogEntries table fills the disk
Short answer
When the historian server has no SQL Server login with read access to the PIAF database, each failed diagnostic read appends a row to dbo.LogEntries and a matching Windows event, so the disk fills fast. Add the machine account as a login with db_datareader, disable Diagnostics storage in VantagePoint Manager, then batch-delete the rows and shrink the file.
On this page
- What is filling the disk on the historian server?
- Why does a missing login cause thousands of rows?
- How do I add the machine account as a SQL Server login?
- How do I stop the log writes immediately?
- How do I find out which table holds the space?
- Why does a single DELETE run out of disk space, and what do I run instead?
- How do I clear the mirrored Windows event logs?
- How do I verify the fix holds?
- Questions asked
A Historian SE server attached to a SQL Server on another machine can fill its data drive in a shift, and the space is not in the archive: it is in the IncuityDiagnostics database, in dbo.LogEntries, with a matching copy in the Windows Application log. The cause is a missing SQL Server login for the historian machine account. The documented containment and cleanup are in this IncuityDiagnostics database growth fix, and the steps below follow it.
What is filling the disk on the historian server? #
The disk is being consumed by two mirrored copies of the same failed diagnostic reads: rows in dbo.LogEntries in the IncuityDiagnostics database, and Windows Application events on the historian server and the SQL Server. One reported case logged about 19,000 entries before the cause was found, and the free space dropped by hundreds of megabytes to several gigabytes in a day. The archive itself is not growing abnormally; the diagnostics store is.
The IncuityDiagnostics database ships with no retention policy, so nothing purges those rows on its own. As long as the underlying fault runs, every diagnostic cycle appends another entry, and the diagnostics subsystem then attempts to read its own log table again on the next cycle, re-triggering the failure. The Windows event log grows in proportion because Event Viewer mirrors every entry.
Why does a missing login cause thousands of rows? #
The historian service reads the PIAF database using its machine account, and when that account has no SQL Server login, every read throws a login failure that the diagnostics subsystem writes back to its own log table. The error names the account in the form of the domain, the server name and a trailing dollar sign, and it repeats at the frequency of the diagnostic cycle, which is why the count climbs so quickly.
The signature to confirm before changing anything:
- The SQL Server error log shows login-failure entries from the historian server's computer name, at high frequency.
- The Windows Application log on the SQL Server machine shows the same failures, at the same frequency the VantagePoint database logs errors.
- The row count of dbo.LogEntries is in the tens of thousands, and viewing the rows shows repeated failed-login and service-timeout entries.
- Free space on the historian host declines every hour.
If your growth rate is not yet quantified, measure it first so you know how long you have; the method in estimating historian disk space from measured daily growth works for any database file on the host, including this one.
How do I add the machine account as a SQL Server login? #
Connect to the SQL Server that hosts PIAF and IncuityDiagnostics with a sysadmin account, then add the historian's computer account as a login mapped to the PIAF database with db_datareader. In the reported case the login-failure messages stopped immediately after this step.
- Open SQL Server Management Studio and connect to the instance that hosts PIAF.
- Under Security, expand Logins and confirm whether a login exists for the historian server's machine account, written as the domain, a backslash, the server name and a trailing dollar sign, for example DOMAIN\HISTSERV$.
- If it is missing, right-click Logins, choose New Login, and search for the historian's computer account.
- On the User Mapping page, map the login to the PIAF database and grant db_datareader. Read access is all the diagnostics read path needs; do not grant write roles.
- Apply, then retest the VantagePoint connection from the historian server and confirm the login failures no longer appear in the SQL Server error log.
The same requirement applies when PIAF sits on a separate box from the historian service, not only when the whole SQL Server is remote. Any topology where the diagnostics read crosses a machine boundary needs this login.
How do I stop the log writes immediately? #
Disable the Diagnostics storage service in FactoryTalk VantagePoint Manager, which stops new writes to dbo.LogEntries at once, even before the database is cleaned up. Open VantagePoint Manager, go to System > Services > Storage, right-click Diagnostics and choose Edit, then clear the Allow Direct Queries and Enabled boxes and apply.
The same editor offers a size-based aging strategy if you prefer to keep diagnostics on: set a maximum size, and the store keeps only the most recent entries past that size. Keep in mind Windows Event Viewer mirrors all of these entries anyway, so in most plants the SQL copy adds storage cost without adding information, and leaving it disabled is the simpler end state.
Stopping the writes does not shrink anything: the existing rows and the grown file stay on disk until you delete and shrink. Windows Event Viewer also keeps receiving its copies until the login fix from the previous section is in place, so the login comes first.
How do I find out which table holds the space? #
Check the storage properties of each table in the IncuityDiagnostics database before deleting anything, because the offender is almost always dbo.LogEntries but secondary consumers hide in the dbo.History tables. In SQL Server Management Studio, expand Databases, then IncuityDiagnostics, then Tables, right-click a table, choose Properties and open the Storage page, and compare Row count and Data space across the tables.
For a single-query view of all tables at once, run this in a query window against IncuityDiagnostics:
SELECT t.name AS TableName,
p.rows AS RowCounts,
CAST(ROUND((SUM(a.total_pages) * 8) / 1024.0, 2) AS DECIMAL(18,2)) AS TotalSpaceMB,
CAST(ROUND((SUM(a.used_pages) * 8) / 1024.0, 2) AS DECIMAL(18,2)) AS UsedSpaceMB
FROM sys.tables t
INNER JOIN sys.indexes i ON t.object_id = i.object_id
INNER JOIN sys.partitions p ON i.object_id = p.object_id AND i.index_id = p.index_id
INNER JOIN sys.allocation_units a ON p.partition_id = a.container_id
WHERE t.is_ms_shipped = 0
GROUP BY t.name, p.rows
ORDER BY UsedSpaceMB DESC;
The first row tells you where the space went. Open the largest table and view its rows: a wall of failed-login entries for the machine account confirms the diagnosis.
Why does a single DELETE run out of disk space, and what do I run instead? #
One large DELETE grows the transaction log before it frees data pages, and on a drive that is already full there is no room for that log growth, so the delete fails; a batched delete with checkpoints between batches needs only room for one batch at a time. With the writes stopped and the login fixed, run this against IncuityDiagnostics:
USE IncuityDiagnostics;
GO
DECLARE @BatchSize INT = 5000;
DECLARE @Deleted INT = 1;
WHILE @Deleted > 0
BEGIN
DELETE TOP (@BatchSize)
FROM dbo.LogEntries
WHERE [Timestamp] < DATEADD(DAY, -7, GETUTCDATE());
SET @Deleted = @@ROWCOUNT;
CHECKPOINT;
END
DBCC SHRINKFILE (IncuityDiagnostics_log, 1024);
DBCC SHRINKDATABASE (IncuityDiagnostics, 10);
Worked example: suppose dbo.LogEntries holds 19,000 rows at roughly 1 KB per row including index overhead, about 19 MB of data, but the file has grown to 3 GB because the failed read loop also churned the log. With batches of 5000 rows the loop takes 4 passes (19,000 divided by 5000 is 3.8, rounded up), and each pass needs log space for at most 5000 rows, about 5 MB, which fits on a nearly full drive where a 19 MB single delete with its log overhead might not. If even one batch fails for space, temporarily add a second log file on a volume with free space, or set the database to SIMPLE recovery for the duration of the cleanup. Never run the shrink while the Diagnostics service is still writing to the file.
How do I clear the mirrored Windows event logs? #
Clear the Application and System logs on both the historian server and the SQL Server, because Event Viewer accumulated a copy of every failed read and that copy also occupies disk. In Event Viewer, right-click each log and choose Clear Log; optionally raise the maximum log size and enable overwrite as needed so the same loop cannot fill the drive again.
How do I verify the fix holds? #
After the login, the disable and the cleanup, verify four things: free space stops declining, no new login failures appear, the row count stays flat, and VantagePoint runs normally. Check each one once, then check free space again an hour later.
- On the SQL Server, confirm the newest MSSQLSERVER entries in the Application log contain no login failures from the historian's computer name.
- Re-run the table-size query; dbo.LogEntries should stay at its post-cleanup count because the writes are disabled.
- On the historian server, check free space with PowerShell (
Get-PSDrive, selecting Name, Used and Free) now and again in an hour; the number should be stable. - Open VantagePoint Manager and confirm Diagnostics shows disabled under System > Services > Storage, and that your production dashboards still return data.
Questions asked
Can I just clear the Windows event logs and leave the database alone?
No. Clearing the Application and System logs frees the mirrored copy but leaves dbo.LogEntries in place, so the database stays bloated and the login failures continue as long as the machine account is missing. Fix the login first, stop the writes second, and only then clear both stores.
Why does the delete fail with not enough disk space?
A single large DELETE against a full recovery or heavily logged database grows the transaction log before it frees data pages, and there is no room left for that growth. Delete in batches of a few thousand rows with a checkpoint between batches, or temporarily add a second log file on a volume with free space.
Does disabling Diagnostics storage affect historian data collection?
No. The Diagnostics storage service under VantagePoint Manager only records diagnostic and error entries; the archive and the PIAF read path for production data are separate services. Since Windows Event Viewer mirrors the same entries, you keep the error history and lose only the SQL copy.
Which account exactly needs the SQL Server login?
The historian server's computer account, written as the domain name, a backslash, the server name and a trailing dollar sign, for example DOMAIN\HISTSERV$. Select it under Security > Logins in SQL Server Management Studio, map it to the PIAF database and grant db_datareader. The same fix applies when PIAF sits on a separate box from the historian service.