ratelimit icon indicating copy to clipboard operation
ratelimit copied to clipboard

How to turn off gostats log

Open ShyunnY opened this issue 1 year ago • 0 comments

I use ratelimit in kubernetes, and when I checked the logs, I found a lot of log output about gostats.

pod.yaml:

apiVersion: v1
kind: Pod
metadata:
  name: "ratelimit-pod"
  namespace: default
  labels:
    app: "ratelimit"
spec:
  containers:
    - name: ratelimit-container
      image: envoyproxy/ratelimit:master
      command:
        - /bin/ratelimit
      env:
        - name: LOG_FORMAT
          value: json
        - name: LOG_LEVEL
          value: error
        - name: REDIS_SOCKET_TYPE
          value: tcp
        - name: REDIS_URL
          value: redis-service.default.svc.cluster.local:6379
        - name: RUNTIME_ROOT
          value: /data
        - name: RUNTIME_SUBDIRECTORY
          value: ratelimit
        - name: RUNTIME_WATCH_ROOT
          value: "false"
        - name: USE_STATSD
          value: "false"
        - name: MERGE_DOMAIN_CONFIG
          value: "true"
        - name: TRACING_ENABLED
          value: "true"
        - name: TRACING_EXPORTER_PROTOCOL
          value: "http"
        - name: TRACING_SERVICE_NAMESPACE
          value: "production"
        - name: TRACING_SERVICE_INSTANCE_ID
          value: "ratelimit-envoy"
        - name: OTEL_EXPORTER_OTLP_ENDPOINT
          value: "xxx"
      ports:
        - containerPort: 8080
        - containerPort: 8081
        - containerPort: 6070
      volumeMounts:
        - name: ratelimit-config
          mountPath: /data/ratelimit/config
          subPath: config
  volumes:
    - name: ratelimit-config
      configMap:
        name: ratelimit-config
        items:
          - key: demo.yaml
            path: config/demo.yaml
          - key: demo1.yaml
            path: config/demo1.yaml

k logs ratelimit-pod:

$ k logs ratelimit-pod
time="2024-03-18T05:38:05Z" level=info msg="TracerProvider initialized with following parameters: protocol: http, serviceName: RateLimit, serviceNamespace: production, serviceInstanceId: ratelimit-envoy, samplingRate: 1.000000"
{"level":"info","ts":1710740295.077808,"logger":"gostats.loggingsink","msg":"flushing counter","json":{"name":"runtime.load_attempts","type":"counter","value":"1.000000"}}
{"level":"info","ts":1710740295.077901,"logger":"gostats.loggingsink","msg":"flushing counter","json":{"name":"ratelimit.service.config_load_success","type":"counter","value":"1.000000"}}
{"level":"info","ts":1710740295.077909,"logger":"gostats.loggingsink","msg":"flushing counter","json":{"name":"ratelimit.go.mallocs","type":"counter","value":"15065.000000"}}
{"level":"info","ts":1710740295.077915,"logger":"gostats.loggingsink","msg":"flushing counter","json":{"name":"ratelimit.go.totalAlloc","type":"counter","value":"2353688.000000"}}
{"level":"info","ts":1710740295.077918,"logger":"gostats.loggingsink","msg":"flushing counter","json":{"name":"ratelimit.go.frees","type":"counter","value":"1959.000000"}}
{"level":"info","ts":1710740295.077922,"logger":"gostats.loggingsink","msg":"flushing counter","json":{"name":"ratelimit.redis_pool.cx_total","type":"counter","value":"10.000000"}}
{"level":"info","ts":1710740295.078022,"logger":"gostats.loggingsink","msg":"flushing gauge","json":{"name":"ratelimit.go.nextGC","type":"gauge","value":"4194304.000000"}}
{"level":"info","ts":1710740295.078035,"logger":"gostats.loggingsink","msg":"flushing gauge","json":{"name":"ratelimit.go.alloc","type":"gauge","value":"2353688.000000"}}
{"level":"info","ts":1710740295.078042,"logger":"gostats.loggingsink","msg":"flushing gauge","json":{"name":"ratelimit.go.heapSys","type":"gauge","value":"3440640.000000"}}
{"level":"info","ts":1710740295.078046,"logger":"gostats.loggingsink","msg":"flushing gauge","json":{"name":"ratelimit.go.heapIdle","type":"gauge","value":"237568.000000"}}
{"level":"info","ts":1710740295.078057,"logger":"gostats.loggingsink","msg":"flushing gauge","json":{"name":"ratelimit.go.heapAlloc","type":"gauge","value":"2353688.000000"}}

I tried configuring the environment variable with USE_STATSD=false but it doesn't seem to help me How can I prevent these gostats log output?

ShyunnY avatar Mar 18 '24 05:03 ShyunnY