Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

263
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda