Logical logs in Neo4j are the journal of which operations happens and are the source of truth in scenarios where the database needs to be recovered after a crash or similar. Logs are rotated every now and then (defaults to when they surpass 250 Mb in size) and the amount of legacy logs to keep can be configured. Purpose of keeping a history of logical logs include being able to serve incremental backups as well as keeping an HA cluster running.
For any given configuration at least the latest non-empty logical log will be kept, but configuration can be supplied to control how much more to keep. There are several different means of controlling it and the format in which configuration is supplied is:
dbms.tx_log.rotation.retention_policy=<true/false> dbms.tx_log.rotation.retention_policy=<amount> <type>
For example:
# Will keep logical logs indefinitely dbms.tx_log.rotation.retention_policy=true # Will keep only the most recent non-empty log dbms.tx_log.rotation.retention_policy=false # Will keep logical logs which contains any transaction committed within 30 days dbms.tx_log.rotation.retention_policy=30 days # Will keep logical logs which contains any of the most recent 500 000 transactions dbms.tx_log.rotation.retention_policy=500k txs
Full list:
Type | Description | Example |
---|---|---|
files | Number of most recent logical log files to keep | "10 files" |
size | Max disk size to allow log files to occupy | "300M size" or "1G size" |
txs | Number of latest transactions to keep Keep | "250k txs" or "5M txs" |
hours | Keep logs which contains any transaction committed within N hours from current time | "10 hours" |
days | Keep logs which contains any transaction committed within N days from current time | "50 days" |