简体   繁体   English

如何访问docker-compose中的所有nginx日志?

[英]How do I access ALL the nginx logs in docker-compose?

I have the following in my docker-compose.yml file: 我的docker-compose.yml文件中包含以下内容:

version: '3'
services:  
  nginx:
    build: ./nginx
    container_name: nginx
    environment:
      NGINX_DOMAIN: mydomain.com
    ports:
      - 80:80
      - 443:443
    volumes:
      - ${DIR}/nginx:/var/log/nginx
      - /etc/letsencrypt:/etc/letsencrypt
    restart: on-failure:5
    network_mode: host

This will forward access.log and error.log files to /my/dir/nginx. 这会将access.log和error.log文件转发到/ my / dir / nginx。 How do I also forward access1.log, error1.log and all the other rotated logs? 我还该如何转发access1.log,error1.log和所有其他循环日志? Alternatively, I don't need to actually forward the logs to the directory as I can just access them directly I suppose. 或者,我不需要实际将日志转发到目录,因为我可以直接访问它们。

I don't understand the question... 我不明白这个问题...

You are mounting a volume on the /var/log/nginx folder, if you do so, you will have all the logs that are inside the folder, if a rotation exists they will simply appear as in nginx log folder. 您正在/ var / log / nginx文件夹上安装卷,如果这样做,则将具有该文件夹内的所有日志,如果存在旋转,则它们将简单地显示在nginx日志文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM