How to setup logrotate on Bitwarden rs

Hello,
I’m running bitwarden rs in a docker on an Ubuntu server.
I would like to setup logrotate on the /bwdate/bitwarden.log file.
Does anyone has a suggestion for the right logrotate.d file content?

Edit:
I just found this:
/etc/logrotate.d/bitwarden :

/var/log/bitwarden/bitwarden.log
{
rotate 52
dateext
weekly
missingok
notifempty
compress
sharedscripts
postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript
}

Does this work on Ubuntu server? I’m in doupt about the postrotate part.

I would use copytruncate and you can remove the invoke-rc.d line.

Okay, so it would look like this:

/var/log/bitwarden/bitwarden.log
{
        rotate 52
        copytruncate
        dateext
        weekly
        missingok
        notifempty
        compress
        sharedscripts
        endscript
}

I have this for my logroate.

{
	rotate 31
	daily
	missingok
	notifempty
	copytruncate
	compress
}

I think you should also remove the sharedscripts and endscript at least.

1 Like

Thank you BlackDex! I’ll try that out.