Logs not structured when both --structured-logs
and --quiet
are used together
#1738
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Bug Description
In an attempt to identify log entries that are actual errors and reduce noise from log entries which aren't, but are detected as such by the default fluentbit log agent (and thus by GCP Logging Explorer) because they are written text form to the POSIX STDERR stream, we tried to configure the Google Cloud Sql Proxy using both:
--structured-logs
(in order to help fluentbit/stackdriver to detect actual errors and not flag text output as errors because it was printed to STDERR)--quiet
(because all those "certificate expires, getting a new one..." or "client opened a new connection..." wasn't giving us much information and we tried to lower the overall logging storage costs.)However, everytime the cloud sql proxy container gets terminated (because of a simple scaledown of the pod it is living in), we noticed the unstructured log output (to STDERR):
SIGTERM signal received. Shutting down...
which is coming fromcloud-sql-proxy/cmd/root.go
Line 840 in 6284a69
First: This is arguably not an error.
Second: This is also not structured, because whenever
--structured-logs
is used together with--quiet
, the structured logger is again replaced by the NewStdLogger, as can be seen in this code section:cloud-sql-proxy/cmd/root.go
Lines 344 to 349 in 6284a69
It would be nice, if both:
SIGTERM signal received. Shutting down...
would not be logged/treated as an error (maybe a warning)Example code (or command)
No response
Stacktrace
No response
Steps to reproduce?
Run cloudsql proxy with both
--structured-logs
and--quiet
and issue a SIGTERM signal (as is used in Kubernetes) to stop it.Environment
./cloud-sql-proxy --version
): 2.1.2./cloud-sql-proxy --enable_iam_login --dir /path/to/dir INSTANCE_CONNECTION_NAME
):Additional Details
No response
The text was updated successfully, but these errors were encountered: