File-log plugin not able to log to /dev/stdout

We are trying to use the file log plugin on our Kong deployed in K8s environment.

Also, I went through the file-log official documentation. It says You can also specify streams (for example, /dev/stdout and /dev/stderr), which is especially useful when running Kong in Kubernetes. , but the exact process is not specified.
Currently, I am logging into /usr/local/kong/logs/requestDetails.log after chmod 777 on this file.
I tried doing the same for the path /dev/stdout but after the API call, file-log gives me the error permission denied again (I think chmod is not working here as it is not a proper file). As a result of this, our Graylog is not able to pick up these logs.
This is the permission on /dev/stdout -
lrwxrwxrwx 1 root root 15 Nov 10 13:16 /dev/stdout -> /proc/self/fd/1
I have not changed anything for the Kong workers so I am not sure what users are they running as. Although, I think it is kong.
Also I have tried doing chmod 777 on /dev/stdout but that didn’t help.

Any ideas on how to solve this?

I recommend to see the documentation for logging stategies on Kubernetes Logging Architecture | Kubernetes.

I implement the same plugin ok k8s with Helm templates like this :

part helm:
if you use deployment strategie

kong_values.yaml

deployment:      
  userDefinedVolumes:
    - name: "logfile"
  userDefinedVolumeMounts:
    - name: "logfile"
      mountPath: "/logs"

kong.yml

  - name: file-log
    config:
      path: /logs/kong.log
      reopen: false

I think filing an issue to GitHub - Kong/docker-kong: Docker distribution for Kong is the correct approach here.

There’s a generic Docker issue that affects the ability of non-root processes to write to stdout, though indications are that we’ve added workarounds for it in the past. There may have been a regression at some point.

I’m unsure if there’s some difference between the NGINX access logs and file-log, though arguably they shouldn’t behave differently.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ