Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

262
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!