Home > Back-end >  Is there a way to show less service logs in console in docker-compose?
Is there a way to show less service logs in console in docker-compose?

Time:11-15

Now when I'm running my app using docker-compose up i get in console lot of logs from mongoDb

screen from terminal

I want to get only "web" service related logs for my information as logs from mongo are unreadable and useless for me in development.

I tried using

command: --quiet
logs:
    driver: none

And didn't get quite the result i was hoping for. I want all the docker starting logs describing what is going on while staring but then none of the mongo health raports

CodePudding user response:

Start docker-compose in detached mode and bind the logs of your app to stdout:

    docker-compose up -d
    docker ps
    docker logs [YOUR_CONTAINER_ID] --follow

CodePudding user response:

For me the best solution was adding file

#mongod.conf
systemLog:
  destination: file
  path: "/var/log/mongodb/mongod.log"

and in docker-compose

#docker-compose.yml
mongo:
    volumes:
      - ./data:/data/db
      - ./mongod.conf:/etc/mongod.conf
    ports:
      - '27017:27017'
    restart: unless-stopped
    command: --config /etc/mongod.conf
  • Related