rsnapshot
rsnapshot copied to clipboard
'retain' parameter with 'include_conf' does not work as expected
Checklist
- [X] I'm reporting a bug
- [X] I've searched the bugtracker for similar issues, including closed ones.
What did you do?
- create base config file
base.conf
with generic retain parameters
logfile /var/log/base.log
retain daily 7
retain weekly 4
retain monthly 12
- create instance config file
instance01.conf
with specific overriding retain parameters
include_conf base.conf
logfile /var/log/instance01.log
retain daily 30
retain monthly 24
- execute rsnapshot
$ rsnapshot -t -c ./instance01.conf daily
What happened?
- expectedly, rsnapshot creates a logfile
/var/log/instance01
- unexpectedly, rsnaphot retains only 7 copies of the "daily" backup level
What did you expect to happen
- rsnaphot should retain 30 copies of the "daily" backup level, as the
retain daily 30
parameter from the instance01 configuration succeeds, and hence should overwrite theretain daily 7
parameter from the base configuration.
My configuration
see above for a minimal example
Environment
* OS: CentOS Linux 7.9
* Filesystem: XFS
* rsnapshot : v1.4.5
Other information
When including a config file, the contents of the config file are inserted at that specific location :
$ man rsnapshot
...
include_conf Include another file in the configuration at this point.
-
As expected, subsequent parameter values override previous parameter values (cfr.
logfile
). -
This is apparently not the case for the
retain
parameter, which seems to add all encountered parameter values to an array, indifferent to already existing "name" backup level occurances.
Remediation :
- only new backup level "name"s should be added to the array ;
- exisiting backup level "name"s should be overwritten with the new "number" value.
Current mitigation :
- include base configs at the end of the instsance config (unwanted, as this prevents overwriting base conf parameters)
- do not define
retain
parameters in the base config.