Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

docker

nginx

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?

like image 573
kumar Avatar asked Jan 22 '26 01:01

kumar


1 Answers

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
like image 171
AttaBoy Avatar answered Jan 23 '26 17:01

AttaBoy