Bootstrap FreeKB - Kong Enterprise Edition (KongEE) - KONG_LOG_LEVEL on OpenShift
Kong Enterprise Edition (KongEE) - KONG_LOG_LEVEL on OpenShift


If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

The oc get deployments command can be used to display the deployments in the kong project.

~]$ oc get deployments --namespace kong
NAME                 READY   UP-TO-DATE   AVAILABLE   AGE
kong-2.4.1.1         3/3     3            3           118d
postgres             1/1     1            1           125d

 

The oc describe deployment command can be used to display the KONG_LOG_LEVEL.

~]$ oc describe deployment kong-2.4.1.1 --namespace kong | grep -i log
      KONG_LOG_LEVEL:                                  warn
      KONG_PROXY_ACCESS_LOG:                           /dev/stdout
      KONG_PROXY_ERROR_LOG:                            /dev/stderr
      KONG_AUDIT_LOG:                                  on

 

The following log levels can be used.

  • debug
  • info
  • warn
  • error

 

The oc edit command can be used to change the log level.

oc edit deployment kong-admin-2.4.1.1 --namespace kong

 

Let's say KONG_LOG_LEVEL is changed to debug.

spec:
  template:
    spec:
      containers:
      - env:
        - name: KONG_LOG_LEVEL
          value: debug

 

Something like this should be displayed.

deployment.apps/kong-2.4.1.1 edited

 

The current pods should automatically be terminated and new pods should be created, started, and running.

If for whatever reason the current pods are not terminated and the new pods are not running, the deployment can be scaled down to 0, which should terminate the pods.

oc scale deployment kong-2.4.1.1 --namespace kong --replicas=0

 

Then scale the deployment up to 1 or more replicas.

oc scale deployment kong-2.4.1.1 --namespace kong --replicas=1

 

Now KONG_LOG_LEVEL should be updated.

~]$ oc describe deployment kong-2.4.1.1 --namespace kong | grep -i log
      KONG_LOG_LEVEL:                                  debug
      KONG_PROXY_ACCESS_LOG:                           /dev/stdout
      KONG_PROXY_ERROR_LOG:                            /dev/stderr
      KONG_AUDIT_LOG:                                  on

 

And in the newly created pod.

~]$ oc describe pod kong-2.4.1.1-9fbc49f4-2hwrb --namespace kong | grep -i log
      KONG_LOG_LEVEL:                debug
      KONG_ADMIN_ACCESS_LOG:         /dev/stdout
      KONG_ADMIN_ERROR_LOG:          /dev/stderr
      KONG_ADMIN_GUI_ACCESS_LOG:     /dev/stdout
      KONG_ADMIN_GUI_ERROR_LOG:      /dev/stderr
      KONG_PORTAL_API_ACCESS_LOG:    /dev/stdout
      KONG_PORTAL_API_ERROR_LOG:     /dev/stderr
      KONG_AUDIT_LOG:                on

 

And the oc logs command should show that events are being logged at the new log level.

~]$ oc logs pod/kong-2.4.1.1-9fbc49f4-2hwrb --namespace kong
2021/12/09 10:10:40 [debug] 28#0: *15191 [lua] init.lua:446: [vitals] starting vitals timer (2) in 10 seconds
2021/12/09 10:10:40 [debug] 28#0: *15191 [lua] init.lua:1015: flush_counters(): [vitals] pid 28 caching metrics for 1639044630
2021/12/09 10:10:40 [debug] 28#0: *15191 [lua] init.lua:1067: flush_counters(): [vitals] flush done
2021/12/09 10:10:40 [debug] 25#0: *15192 [lua] init.lua:446: [vitals] starting vitals timer (2) in 10 seconds
2021/12/09 10:10:40 [debug] 25#0: *15192 [lua] init.lua:1015: flush_counters(): [vitals] pid 25 caching metrics for 1639044630
2021/12/09 10:10:40 [debug] 25#0: *15192 [lua] init.lua:1067: flush_counters(): [vitals] flush done
2021/12/09 10:10:40 [debug] 26#0: *15189 [lua] init.lua:1039: flush_counters(): [vitals] merge worker data
2021/12/09 10:10:40 [debug] 26#0: *15189 [lua] init.lua:1046: flush_counters(): [vitals] execute strategy insert
2021/12/09 10:10:40 [debug] 26#0: *15189 [lua] init.lua:1053: flush_counters(): [vitals] delete expired stats
2021/12/09 10:10:40 [debug] 26#0: *15189 [lua] init.lua:919: flush_vitals_cache(): [vitals] flushing vitals cache
2021/12/09 10:10:40 [debug] 26#0: *15189 [lua] init.lua:997: flush_vitals_cache(): [vitals] total keys processed: 0
2021/12/09 10:10:40 [debug] 26#0: *15189 [lua] init.lua:1067: flush_counters(): [vitals] flush done

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter f8f05f in the box below so that we can be sure you are a human.