I have my nodes on a RockPro64 sbc, running Debian BullsEye. Bitcoin Core version is v0.21.1 and C-Lightning is v0.10.1-38-g8f782b0. Logrotate is logrotate 3.18.0.
Bitcoin Core log file is in ~/.bitcoin and c-lightning log file is in ~/lightningd. Both are named debug.log
So, at the beginning I set only Bitcoin Core log file to be rotated based on size. Max size I set was 50Mb. But I set the cronjob to run only once a day, and probably this is way too much time for the 50Mb size, so I'm getting files with sizes ranging from 400Mb up to 500Mb roughly.
To get this behaviour to happen, I created a file named bitcoin in /etc/logrotate.d/ and there is (by default, I suppose) a logrotate executable script inside /etc/con.daily/.
The file bitcoin I created with the rules for logrotate to execute for Bitcoin Core log file is this:
/home/rp64/.bitcoin/debug.log{
daily
rotate 5
missingok
copytruncate
notifempty
maxsize 50M
delaycompress
sharedscripts
postrotate
kill -HUP `cat /home/rp64/.bitcoin/bitcoind.pid`
endscript
}
This seems to work by itself but the 50Mb are not being respected. I assume that it's because logrotate running only once a day, will not be enough to respect the 50Mb because Bitcoin Core is probably logging way more info than the 50Mb.
Note: I have Bitcoin Core running as a system service, so I start it with systemctl start bitcoind. Actually it starts automatically.
But now, I was trying to duplicate this logrotate settings to C-Lightning node and I'm not sure I can use exactly the same settings for the postrotate scripts once C-Lightning is not running as a system service.
This is one question.
The other question I have is if to get 50Mb size files, It's only move the logrotate script inside /etc/cron.hourly and if that won't affect any other pre-configured rules that Debian set up automatically.
Thanks
dkvtx