Changing Neo4j transaction log rotation and size
Overview
Neo4j - the graph database system used to power the CAST Imaging results - keeps track of all write operations to each database to ensure data consistency and enable recovery. This information is stored in files known as transactional logs located here:
Microsoft Windows
%PROGRAMDATA%\CAST\Imaging\CAST-Imaging-Viewer\Neo4jData\transactions\neo4j
Linux via Docker:
/opt/cast/installation/imaging-viewer/neo4j/neo4j5_data/transactions
Out of the box CAST Imaging is configured to store transactional logs as follows via the following settings in the neo4j.conf file:
db.tx_log.rotation.retention_policy=10 files
db.tx_log.rotation.size=250M
- Max number of transactional log files retained on disk:
10(when the total number of files reaches 10, the next new transactional log file created will cause the oldest archive to be deleted from disk). - Max size of the current transactional log file:
250MB(when the file reaches this size it is archived and a new file is started)
This means that the total size of the transactional log files should not exceed 2.5GB. However if you are facing disk space issues due to the size of the transaction log files, you can change the default behaviour as described below.
You can find out more about the transactional log files and their rotation settings in https://neo4j.com/docs/operations-manual/current/database-internals/transaction-logs/
Microsoft Windows
Step 1 - Edit the neo4j.conf file
Locate the following file:
%PROGRAMDATA%\CAST\Imaging\CAST-Imaging-Viewer\setup-config\neo4j\neo4j.conf
Edit the file, update the following entries as required by your environment and then save the file:
db.tx_log.rotation.retention_policy=10 files
db.tx_log.rotation.size=250M
Step 2 - Run the update script
Run the following command (from a CMD window with elevated permissions (right click, Run as administrator)) to ensure that the service is updated with the new configuration:
%PROGRAMFILES%\CAST\Imaging\CAST-Imaging-Viewer\neo4j\bin neo4j windows-service update
Step 3 - Restart services
Finally, restart the CAST Imaging Viewer Neo4j Graph DB Microsoft Windows service to ensure your changes are taken into account.
Linux via Docker/Podman
The neo4j.conf is not exposed out of the box, therefore to set the transaction log rotation and size, you will need to choose a neo4j.conf customization method as described in Customizing Neo4j.