9.2. Transaction logs

This section explains the retention and rotation policies for the Neo4j logs and how to configure them.

The transaction logs record all operations in the database. They are the source of truth in scenarios where the database needs to be recovered. Transaction logs are used to provide for incremental backups, as well as for cluster operations. For any given configuration at least the latest non-empty transaction log will be kept.

By default, log switches happen when log sizes surpass 250 MB. This can be configured using the parameter Table A.182, “dbms.tx_log.rotation.size”.

There are several different means of controlling the amount of transaction logs that is kept, using the parameter Table A.181, “dbms.tx_log.rotation.retention_policy”. The format in which this is configured 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 transactions to 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"