Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging #621

Closed
mrquokka opened this issue Feb 6, 2018 · 5 comments
Closed

Logging #621

mrquokka opened this issue Feb 6, 2018 · 5 comments

Comments

@mrquokka
Copy link

mrquokka commented Feb 6, 2018

Hi there, can someone help to clear unnecessary logs, such us

фев 06 14:42:07 user-VirtualBox patroni[14532]: 2018-02-06 14:42:07,473 INFO: Lock owner: postgresql0; I am postgresql0
фев 06 14:42:07 user-VirtualBox patroni[14532]: 2018-02-06 14:42:07,482 INFO: no action.  i am the leader with the lock

I tried to change postgresql parameters, such us:

    log_min_messages: 'NOTICE'
    client_min_messages: 'NOTICE'
    log_min_error_statement: 'NOTICE'

and
init.py on source:

logging.basicConfig(format=logformat, level=logging.WARNING)

But nothing changes

@alexeyklyukin
Copy link
Contributor

Hi,

Those are not PostgreSQL, but Patroni logs, so changing PostgreSQL parameters won't affect them. Why do you think they are 'unnecessary'? Patroni reports every iteration of the event loop its role and who is the leader. Knowing that is important in order to understand, for instance, why did the failover happen.

You can mute the INFO messages from the event loop by setting the level in a ha.py.

We may also provide some way of controlling log levels in the future. Feel free to contribute a PR if you are interested.

@antineutron
Copy link
Contributor

I've submitted #622 to make log level configurable using environment vars, but as these are at INFO level it'd still require hacking ha.py to mute the event loop messages.

@mrquokka
Copy link
Author

mrquokka commented Feb 9, 2018

Alexey, thanks for answer. Because system work stable, without reboot and changes, but they write to syslog every second. I really need only first message who i master and messanges when patroni change master, no more

@alexeyklyukin
Copy link
Contributor

@mrquokka feel free to submit a PR. I think it makes sense to have a group of N messages (so that Patroni says 'Leader with a lock (repeated N times)'.

@antineutron I think your PR needs to change how the loggers are spawned, so that there is a single place to set the logging level. Also, we might want to set this parameter in the configuration file rather than via the environment variables (and change it with a reload of Patroni without stopping its operations).

@combrs
Copy link

combrs commented Jan 24, 2019

  • to log repeating messages about leader & lock in batches.
    For example, in config set logging option 'log_batches: 100'
    and then buffer repeated messages in memory. Write it to disk like

[Repeated 100 times] : Lock owner: postgresql0; I am postgresql0; no action; i'm a leader with the lock

In one string
Other messages, of course, write immediately.

@hughcapet hughcapet closed this as not planned Won't fix, can't repro, duplicate, stale Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants