Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Conversation

tux-o-matic
Copy link

@tux-o-matic tux-o-matic commented Mar 11, 2020

Proposed changes

Since this Nginx configuration is meant to be used as a Router running as a container in OpenShift, access logs should be printed to the console log in order to be accessible from the console and collected with Elastic. It will also prevent the local container storage from running full.

Checklist

  • I have read the CONTRIBUTING guide
  • I have proven my fix is effective or that my feature works
  • I have updated necessary documentation
  • I have rebased my branch onto master
  • I will ensure my PR is targeting the master branch and pulling from my branch on my own fork

Since this Nginx configuration is meant to be used as a Router running as a container in OpenShift, access logs should be printed to the console log in order to be accessible from the console and collected with Elastic. It will also prevent the local container storage from running full.
Since this Nginx configuration is meant to be used as a Router running as a container in OpenShift, access logs should be printed to the console log in order to be accessible from the console and collected with Elastic. It will also prevent the local container storage from running full.
@tux-o-matic tux-o-matic changed the title Print access logs to console rather file Print access logs to console rather than a file Mar 11, 2020
@Rulox
Copy link

Rulox commented Mar 11, 2020

Hi @tux-o-matic

Thanks for you time and this PR!

A couple of things. This router was done the same way the official Openshift router. They use logging to a file, that's why we did it this way.

However, this project is going to be deprecated soon in favour of using the Kubernetes Ingress Controller in Openshift. Since Openshift 4.X, Red Hat doesn't allow to use any other router (NGINX, F5 Big IP..) than the official HAProxy one, that's why we are going to support only the Kubernetes Ingress Controller in the future and stop supporting the Router.

Because of this, we can't accept this PR as this project is going to be deprecated soon. However, if you would like to achieve this, I recommend you to use this other approach instead, maybe is easier?

Adding these links in the Dockerfile before building your Router image will send all the logs to the container std output instead of a file.

RUN ln -sf /proc/1/fd/1 /var/log/nginx/access.log \
	&& ln -sf /proc/1/fd/1 /var/log/nginx/stream-access.log \
	&& ln -sf /proc/1/fd/2 /var/log/nginx/error.log

Thanks and sorry for any inconvenience

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants