Merge pull request #10770 from hashicorp/dnephin/log-cert-expiration

telemetry: add log message when certs are about to expire
This commit is contained in:
Daniel Nephin 2021-08-05 15:17:20 -04:00 committed by GitHub
commit b223c2bc25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -140,6 +140,12 @@ func (m CertExpirationMonitor) Monitor(ctx context.Context) error {
logger.Warn("failed to emit certificate expiry metric", "error", err)
continue
}
if d < 24*time.Hour {
logger.Warn("certificate will expire soon",
"time_to_expiry", d, "expiration", time.Now().Add(d))
}
expiry := d / time.Second
metrics.SetGaugeWithLabels(m.Key, float32(expiry), m.Labels)
}