question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PATRONI_LOG_* environment variables are ignored.

See original GitHub issue

It seems that most environment variables are removed before starting the patroni process. I was attempting to configure patroni to log to a directory (instead of stdout) by using the PATRONI_LOG_DIR environment variable, but the runit/patroni/run script seems to be working against me here:

# Only small subset of environment variables is allowed. We don't want accidentally disclose sensitive information
for E in $(printenv -0 | tr '\n' ' ' | sed 's/\x00/\n/g' | grep -vE '^(KUBERNETES_(SERVICE|PORT|ROLE)[_=]|((POD_(IP|NAMESPACE))|HOSTNAME|PATH|PGHOME|LC_ALL|ENABLE_PG_MON)=)' | sed 's/=.*//g'); do
    unset $E
done

ref: https://github.com/zalando/spilo/blob/master/postgres-appliance/runit/patroni/run#L24-L26

Would it be possible to add |(PATRONI_LOG_.*=) to the regex to allow PATRONI_LOG_* variables to be passed to the process?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
CyberDem0ncommented, Apr 14, 2022

You can always inject part of Patroni configuration via SPILO_CONFIGURATION:

{"log":{"level":"DEBUG", ...}}
0reactions
mhaley-tigniscommented, Jul 8, 2022

@CyberDem0n any additional thoughts here? Are we unable to rely on patroni process to protect itself? If not, an alternative solution is here https://github.com/zalando/postgres-operator/pull/1857. Either one solves my needs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment Configuration Settings - Patroni documentation
This document lists all environment variables handled by Patroni. ... PATRONI_LOG_FILE_SIZE: Size of patroni.log file (in bytes) that triggers a log rolling ...
Read more >
Kubernetes environment variables don't seem to take effect
It seems that you don't run Patroni directly, but via Spilo, where the most (if not all) PATRONI_* environment variables are simply ignored....
Read more >
Dynamic configuration settings - Patroni
Dynamic configuration is stored in the DCS (Distributed Configuration Store) and applied on all cluster nodes. Some parameters, like loop_wait , ttl , ......
Read more >
Patroni Documentation - Read the Docs
First of all it should start printing log lines every 5 seconds ... This document lists all environment variables handled by Patroni.
Read more >
Geo - The gitlab-ctl reconfigure fails when enabling a Patroni ...
Summary While spinning up a new Geo deployment with Patroni, ... unmanaged env files for consul service] action run (skipped due to only_if) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found