Skip to content

Commit 9709818

Browse files
committed
add log-definitions to patroni-config
1 parent fa21e8e commit 9709818

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

pkg/cluster/k8sres.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,22 @@ type pgBootstrap struct {
8181
type spiloConfiguration struct {
8282
PgLocalConfiguration map[string]interface{} `json:"postgresql"`
8383
Bootstrap pgBootstrap `json:"bootstrap"`
84+
Log *spiloLogConfiguration `json:"log,omitempty"`
8485
}
8586

8687
type TDEConfig struct {
8788
Enabled bool
8889
KeyBits string
8990
}
9091

92+
type spiloLogConfiguration struct {
93+
Type string `json:"type,omitempty"`
94+
Level string `json:"level,omitempty"`
95+
TracebackLevel string `json:"traceback_level,omitempty"`
96+
StaticFields map[string]string `json:"static_fields,omitempty"`
97+
DeduplicateHeartbeatLogs *bool `json:"deduplicate_heartbeat_logs,omitempty"`
98+
}
99+
91100
func (c *Cluster) statefulSetName() string {
92101
return c.Name
93102
}
@@ -468,6 +477,26 @@ PatroniInitDBParams:
468477
config.PgLocalConfiguration[patroniPGHBAConfParameterName] = patroni.PgHba
469478
}
470479

480+
if patroni.Log != nil {
481+
logConfig := &spiloLogConfiguration{}
482+
if patroni.Log.Type != "" {
483+
logConfig.Type = patroni.Log.Type
484+
}
485+
if patroni.Log.Level != "" {
486+
logConfig.Level = patroni.Log.Level
487+
}
488+
if patroni.Log.TracebackLevel != "" {
489+
logConfig.TracebackLevel = patroni.Log.TracebackLevel
490+
}
491+
if patroni.Log.StaticFields != nil {
492+
logConfig.StaticFields = patroni.Log.StaticFields
493+
}
494+
if patroni.Log.DeduplicateHeartbeatLogs != nil {
495+
logConfig.DeduplicateHeartbeatLogs = patroni.Log.DeduplicateHeartbeatLogs
496+
}
497+
config.Log = logConfig
498+
}
499+
471500
res, err := json.Marshal(config)
472501
return string(res), err
473502
}

0 commit comments

Comments
 (0)