canonical / canonical/postgresql-operator

Patroni has very agressive log rotation policy which breaks grafana-agent log files tracking

Open
#1,924 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 cos 1/stable cos ha with otel collector works correctly
2. Deploy postgres sql operator charm, and relate it to cos using grafana-agent

## Expected behavior
Have a constant stream of logs, without duplicates

## Actual behavior
The following entries appears in loki
2026-07-31 13:16:24.139
2026-07-28 17:52:12 UTC [159890]: INFO: no action. I am (hdev-postgresql-0), the leader with the lock
2026-07-31 13:16:24.139
2026-07-28 10:19:42 UTC [159890]: INFO: no action. I am (hdev-postgresql-0), the leader with the lock
2026-07-31 13:16:24.139
2026-07-31 11:52:52 UTC [159890]: INFO: no action. I am (hdev-postgresql-0), the leader with the lock
2026-07-31 13:16:24.139
2026-07-25 18:36:22 UTC [159890]: INFO: no action. I am (hdev-postgresql-0), the leader with the lock
2026-07-31 13:16:24.139
2026-07-29 17:48:02 UTC [159890]: INFO: no action. I am (hdev-postgresql-0), the leader with the lock
2026-07-31 13:16:24.139
2026-07-30 02:06:22 UTC [159890]: INFO: no action. I am (hdev-postgresql-0), the leader with the lock
2026-07-31 13:16:24.139
2026-07-31 03:13:42 UTC [159890]: INFO: no action. I am (hdev-postgresql-0), the leader with the lock

## Versions

Operating system: nobel

Juju CLI: 3.6.12

Juju agent: 3.6.12

Charm revision: 16/stable 1158

LXD: 5.0.9 but it is not used

## Log output

Juju debug log:

## Additional context

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the PostgreSQL operator deployment related to COS through grafana-agent, then inspect Patroni's log rotation and the grafana-agent log tracking behavior. Confirm the source of the rotation-induced duplicates and verify that logs reach Loki as a continuous stream without duplicate entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
grafana, postgresql, python
Domain
databases, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.