Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

270
Vistas
In Nginx docker how do we see log only from error.log

Nginx Docker file is configured to send error.log to /dev/stderr.

RUN ln -sf /dev/stdout /var/log/nginx/access.log 
    && ln -sf /dev/stderr /var/log/nginx/error.log

When we run docker logs --tail=10 -f nginx it show a combination of both error log and access log. Is there a docker command so I can only see the logs of error.log or stderr?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Try this command to get only error.log:

docker logs -f nginx 1>/dev/null

And this one for access.log:

docker logs -f nginx 2>/dev/null
over 4 years ago · Santiago Trujillo Denunciar

0

From the Dockerfile snippet you added in your question, it looks like you are using the official NGINX image.

The NGINX image is configured to send the main NGINX access and error logs to the Docker log collector by default. This is done by linking them to stdout and stderr, which causes all messages from both logs to be stored in the file/var/lib/docker/containers/\/\-json.log on the Docker Host.

One method is to use the docker API.

You can enable the docker API and query the logs that way, in /etc/default/docker:

DOCKEROPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'

Then:

http://<docker host>:4243/containers/<container name>/logs?stderr=1

See:

https://www.docker.com/blog/tips-for-deploying-nginx-official-image-with-docker/

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda