Kong file-log plugin is not creatting log file and log data

I am trying to log request and response data, while using kong-ingress controller as API-gateway by utilizing kong plugins such as http-log,syslog,file-log.

Stack :

1.kubernetes cluster running in azure
2.pod deployed with host-based routing as service named : example-poc
3.KongPlugin resource created as : kongpluginfilelogexample
4.kong installed asking dbless

Plugin resource :

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
 name: kongpluginfilelogexample
config: 
 path: /var/log/filelog.log
 reopen: false
plugin: file-log

Plugin applied as :

  apiVersion: v1
  kind: Service
  metadata:
    name: example-poc
  annotations:
     konghq.com/plugins: kongpluginfilelogexample**

Therefore , I am expecting a log file will be created in /var/log/filelog.log and I will get the request and response information along with the payload. But, the file was not created.

How to debug this/what am I missing ?

Hi Asraful,

It is probably a privilege issue.

I tried the example code on the official doc

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: file-log-example
config: 
  path: /tmp/file.log
  reopen: false
plugin: file-log

Then I annotate my service

kubectl annotate service whoami-svc konghq.com/plugins=file-log-example

Now I can see /tmp/file.log inside the proxy container.

bash-5.1$ pwd
/tmp
bash-5.1$ ls
file.log

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ