Skip to content

rotate_logs fills the filesystem with unrotated /var/log/rotate_logs.log logfile #993

@kot0dama

Description

@kot0dama

Steps to reproduce

  1. Deploy the charm
  2. Wait for rotate_logs script to kick in

Expected behavior

Rotate logs script saves some disk space and avoids disk filling alerts.

Actual behavior

Rotate logs script fills the disk with errors, breaking the system.

Analysis

pgbackrest seems to already have embedded log rotation system per the logrotate configuration including a date/timestamp. This seems to mess with rotate_logs script.

In any case, rotate_logs script should not log to a file without setting up a rotation, retention and compression for this file in logrotate.

Versions

Operating system: Ubuntu 22.04.5 LTS
Juju CLI: 3.6.5-ubuntu-amd64
Juju agent: 3.6.5
Charm revision: 553
LXD: -

Log output

Juju debug log: irrelevant

/var/log/rotate_logs.log:

error: failed to rename /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250421_19:44.log-20250421_19:45.log-20250421_19:46.log-20250421_19:47.log-20250421_19:48.log-20250421_19:49.log-20250421_19:50.log-20250421_19:51.log-20250421_19:53.log-20250421_19:54.log to /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250421_19:44.log-20250421_19:45.log-20250421_19:46.log-20250421_19:47.log-20250421_19:48.log-20250421_19:49.log-20250421_19:50.log-20250421_19:51.log-20250421_19:53.log-20250421_19:54.log-20250623_06:18.log: File name too long
error: failed to rename /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250421_21:01.log-20250421_21:02.log-20250421_21:03.log-20250421_21:05.log-20250421_21:06.log-20250421_21:07.log-20250421_21:08.log-20250421_21:09.log-20250421_21:10.log-20250421_21:11.log to /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250421_21:01.log-20250421_21:02.log-20250421_21:03.log-20250421_21:05.log-20250421_21:06.log-20250421_21:07.log-20250421_21:08.log-20250421_21:09.log-20250421_21:10.log-20250421_21:11.log-20250623_06:18.log: File name too long
error: failed to rename /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250421_21:54.log-20250421_21:55.log-20250421_21:56.log-20250421_21:57.log-20250421_21:58.log-20250421_21:59.log-20250421_22:00.log-20250421_22:01.log-20250421_22:02.log-20250421_22:03.log to /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250421_21:54.log-20250421_21:55.log-20250421_21:56.log-20250421_21:57.log-20250421_21:58.log-20250421_21:59.log-20250421_22:00.log-20250421_22:01.log-20250421_22:02.log-20250421_22:03.log-20250623_06:18.log: File name too long
error: failed to rename /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250421_23:01.log-20250421_23:02.log-20250421_23:03.log-20250421_23:05.log-20250421_23:06.log-20250421_23:07.log-20250421_23:08.log-20250421_23:09.log-20250421_23:10.log-20250421_23:11.log to /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250421_23:01.log-20250421_23:02.log-20250421_23:03.log-20250421_23:05.log-20250421_23:06.log-20250421_23:07.log-20250421_23:08.log-20250421_23:09.log-20250421_23:10.log-20250421_23:11.log-20250623_06:18.log: File name too long
error: failed to rename /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250422_00:07.log-20250422_00:08.log-20250422_00:09.log-20250422_00:10.log-20250422_00:12.log-20250422_00:13.log-20250422_00:14.log-20250422_00:15.log-20250422_00:16.log-20250422_00:17.log to /var/snap/charmed-postgresql/common/var/log/pgbackrest/dbaas-stg-canonical-cla.postgresql-stanza-create.log-20250422_00:07.log-20250422_00:08.log-20250422_00:09.log-20250422_00:10.log-20250422_00:12.log-20250422_00:13.log-20250422_00:14.log-20250422_00:15.log-20250422_00:16.log-20250422_00:17.log-20250623_06:18.log: File name too long

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions