canonical / canonical/postgresql-operator

`/var/log/rotate_logs.log` not logrotated and is unbounded

Open
#1,259 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
20
Forks
36
Avg merge
4d 15h
Merged PRs (30d)
30

Description

## Steps to reproduce

1. Deploy the charm
2. Relate to `s3-integrator`
3. Trigger backups

## Expected behavior

`/var/log/rotate_logs.log` rotated periodically

## Actual behavior

`/var/log/rotate_logs.log` never gets rotated and is unbounded

## Versions

Operating system: Ubuntu 22.04.5 LTS

Juju CLI: 3.6.8-ubuntu-amd64

Juju agent: 3.6.9

Charm revision: 553

LXD:

## Log output

Juju debug log:

## Additional context

Following on from https://github.com/canonical/postgresql-operator/issues/993, the shipped out `logrotate` config only has this:

```
ubuntu@juju-19ec84-dbaas-stg-seceng-commitment-tracker-db-4:~$ cat /etc/logrotate.d/pgbackrest.logrotate
/var/snap/charmed-postgresql/common/var/log/pgbackrest/*.log {
rotate 10
missingok
notifempty
nocompress
daily
create 0600 snap_daemon snap_daemon
dateext
dateformat -%Y%m%d_%H%M
}
```

There is nothing defined to rotate `/var/log/rotate_logs.log`. Default `/var/log` rotation configs are:

```
ubuntu@juju-19ec84-dbaas-stg-seceng-commitment-tracker-db-4:~$ cat /etc/logrotate.d/rsyslog
/var/log/syslog
/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
{
rotate 4
weekly
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
/usr/lib/rsyslog/rsyslog-rotate
endscript
}
```

I think `/etc/logrotate.d/pgbackrest.logrotate` should have another stanza to rotate out `/var/log/rotate_logs.log` periodically (monthly? weekly?).

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the shipped /etc/logrotate.d/pgbackrest.logrotate configuration and compare its existing stanza with the unbounded /var/log/rotate_logs.log path. Confirm that the configuration rotates that log periodically and verify the resulting logrotate behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
devops, observability-sre
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.