Warning
Potential for Data Loss: The steps detailed in the resolution of this article may result in a loss of critical data if not performed properly. Before beginning these steps, make sure all important data is backed up in the event of data loss. If you are unsure or unfamiliar with any complex steps detailed in this article, please contact Product Support for assistance.
Issue
When EBO servers (ES & AS) no more need to keep the unnecessary TrendLog objects, the obsolete objects need to be deleted from EBO servers, and their log data need to be removed from the Extended Log Storage (PostgreSQL/TimescaleDB) server as well.
Product Line
EcoStruxure Building Operation
Environment
- Building Operation Enterprise Server
- Building Operation Automation Server
- External Log Storage
- PostgreSQL (pgAdmin 4)
- TimescaleDB
Cause
Deleting the obsolete TrendLog objects from EBO servers does not remove the old log data of the obsolete TrendLogs left in the PostgreSQL/TimescaleDB database.
Resolution
Once the obsolete TrendLog objects are deleted from EBO servers, their log data are no longer saved in the PostgreSQL/TimescaleDB. The next task is removing the old log data left in the PostgreSQL/TimescaleDB database.
1. As always, backup current EB & AS’s databases from EBO workstation.
2. As always, backup the current PostgreSQL/TimescaleDB database and save to a safe location.
- Backup the “ebo_db” from the PostgreSQL/TimescaleDB server using the pgAdmin 4 (refer to https://www.pgadmin.org/docs/pgadmin4/development/backup_dialog.html , or refer to page 8 “Backup” section of the “EBO External Log Storage Installer.pdf” document for detail).
3.Remove the obsolete TrendLog from the PostgreSQL/TimescaleDB database (the “ebo_db”).
- Method_1: Delete the EBO TrendLog object from ES & AS’s & TimescaleDB using EBO workstation.
(1) From the EBO workstation, expand the folder (location) of the TrendLog object, and delete the TrendLog object.
(2) From the EBO workstation, go to the TimescaleDB folder (/Server 1/System/External Log Storage/TimescaleDB/Trend /Logs/Tree View), and delete the Trendlog object from PostgreSQL/TimescaleDB database.
(3) Verify the TrendLog disappears from both the EBO and the PostgreSQL/Timescale DB.
- Method_2: If the above Method1 takes a long time to complete, you can delete the TrendLog objects from PostgreSQL/TimescaleDB database directly.
(1) From the EBO workstation, expand the folder (location) of the TrendLog object, and delete the TrendLog object. (Same as item (1) of the above Method_1)
(2) From the PostgreSQL/TimescaleDB server, run the pgAdmin 4, select the “ebo_db”, open the “Query Tool”, and execute the below scripts:
Find the ID of the obsolete TrendLog from the trend_meta table.
Select Externallogid, source from trend_meta where sources like '%TrendLog Name or Path%'
Remove the TrendLog from the 2 tables using the above found Externallogid as below.
Delete from trend_data where externallogid = 1234567890
Delete from trend_meta where externallogid = 1234567890
(3) Verify the TrendLog disappears from both the EBO and the PostgreSQL/Timescale DB.