cloudendpoints / esp

Extensible Service Proxy
https://cloud.google.com/endpoints/
BSD 2-Clause "Simplified" License
280 stars 73 forks source link

Logs displayed as ERROR in Log Viewer #823

Open Emixam23-FCMS opened 3 years ago

Emixam23-FCMS commented 3 years ago

Hii,

We have this configuration:

- name: ep
          image: gcr.io/endpoints-release/endpoints-runtime:1.53.0
          args: [
            "-n", "/etc/nginx/custom/nginx_gin.conf",
            "-p", "{{ .Values.service.port }}",
            "-S", "{{ .Values.service.targetPort }}",
            "-a", "127.0.0.1:XXXX",
            "-s", "{{.Values.endpointsServiceName}}",
            "-R", "managed"
          ]
          resources:
            requests:
              cpu: XXXX
          ports:
            - name: https
              containerPort: {{ .Values.service.targetPort }}
          livenessProbe:
            tcpSocket:
              port: {{ .Values.service.targetPort }}
            initialDelaySeconds: 5
          readinessProbe:
            tcpSocket:
              port: {{ .Values.service.targetPort }}
            initialDelaySeconds: 1
          volumeMounts:
            - name: tls-secret
              mountPath: /etc/nginx/ssl
              readOnly: true
            - name: config-map
              mountPath: /etc/nginx/custom
              readOnly: true

And the thing is, we get the logs as ERROR and we can't understand why:

Error 2020-12-07 18:01:14.416 UTC+1 INFO: Fetching an access token from the metadata service
Error 2020-12-07 18:01:14.420 UTC+1 INFO: Fetching the service config ID from the rollouts service
Error 2020-12-07 18:01:15.100 UTC+1 INFO: Fetching the service configuration from the service management service
Error 2020-12-07 18:01:15.815 UTC+1 INFO: Attribute zone: XXXXXXXXXX
Error 2020-12-07 18:01:15.820 UTC+1 INFO: Attribute project_id: XXXXXXXXXX
Error 2020-12-07 18:01:15.826 UTC+1 INFO: Attribute kube_env: KUBE_ENV
Error 2020-12-07 18:01:15.859 UTC+1 nginx: [warn] Using trusted CA certificates file: /XXXXXXXXXX/trusted-ca-certificates.crt

Any idea? Thanks

nareddyt commented 3 years ago

Yes, this is a known issue. Unfortunately Google Cloud Logging does not understand the log format that ESP produces application logs in. Since ESP logs to stderr, Google Cloud Logging assumes all logs are ERROR level.

I agree it's not the best experience, but you should be able to add filters in Google Cloud Logging to only see log messages that actually contain the text "INFO", "ERROR", etc.

FYI: We solved this issue in ESPv2, all the application logs are in glog format. Google Cloud Logging understands this format for GCE and GKE compute platforms.