Giter Site home page Giter Site logo

Logs about mongo HOT 13 CLOSED

Garito avatar Garito commented on June 9, 2024 4
Logs

from mongo.

Comments (13)

devinrsmith avatar devinrsmith commented on June 9, 2024

+1

from mongo.

tianon avatar tianon commented on June 9, 2024

from mongo.

devinrsmith avatar devinrsmith commented on June 9, 2024

I've got mine setup with a config:

$ cat /opt/testmongo/config/mongo.conf 
systemLog:
  destination: file
  path: "/logs/mongo.log"
  logAppend: true

I try to run docker ... mongo -f /config/mongo.conf and get the error: 2015-04-22T19:24:29.503+0000 SEVERE: Failed global initialization: FileNotOpen Failed to open "/logs/mongo.log"

(But if I run chown -R mongodb /logs inside the container, it works as expected.)

from mongo.

tianon avatar tianon commented on June 9, 2024

from mongo.

devinrsmith avatar devinrsmith commented on June 9, 2024

Agreed.

It's just not immediately obvious why (without investigation into the inner working of the Dockerfile / entrypoint) we receive this error.

I think it should be mentioned in https://github.com/docker-library/docs/tree/master/mongo that destionation: file logging won't work unless the path is accessible to the mongodb user.

from mongo.

tianon avatar tianon commented on June 9, 2024

from mongo.

Garito avatar Garito commented on June 9, 2024

If I want to see a pattern with the existing entrypoint, this project must update the docker-entrypoint.sh adding:
chown -R mongodb /logs/db
In the same line a volume must to be created in de Dockerfile like:
VOLUME /logs/db

This is assuming the fact I'm caching the pattern correctly since my vote will go to do this modifications (the entrypoint and the dockerfile) but with this paths:
/data/mongodb
/logs/mongodb
since I could have more databases and all could fight for the db idea

Another change I would do will be to change the name docker-entrypoint.sh to entrypoint.sh since I don't get the need to add docker-

I don't really know how syslog works but I prefer the file option because I can consume it with logstash without touching the host filesystem

I you are agree with my bet, I could make a pull request to show you the actual changes in context and to test

What do you think?

from mongo.

Garito avatar Garito commented on June 9, 2024

hi again!
here: docker-library/elasticsearch#18 (comment)
make a good point: why to change the default paths for data and logs?

I would like to change my mind and respect the default configuration on the whole docker official images

from mongo.

yosifkit avatar yosifkit commented on June 9, 2024

Actually, we don't have any active config, so we are getting the defaults from the daemon, ie the data dir of /data/db/ (docs.mongodb). This does not conflict with mariadb, mysql, percona, rabbitmq, postgres, elasticsearch, or redis. Changing the data directory will break a non-zero number of users. The default logging, when you don't give a systemLog.destination, is to standard out (docs.mongo).

I would be in favor of documenting how a user can handle logging in a nice way.

from mongo.

Garito avatar Garito commented on June 9, 2024

Then is good enought to me
Agree too with the log issue: seems to me that the correct way is to put them in the mongo's standard location and change the permissions ala data folder in the entrypoint

from mongo.

bagrat avatar bagrat commented on June 9, 2024

Referring to this ticket Docker stores the logs, even to the stdout, so if your restart your container, they will be stored, i.e. you can view old logs using --since option of logs command.

from mongo.

wattletimber avatar wattletimber commented on June 9, 2024

Hi Guys. My container is increasing by a gig everyday please help.

ubuntu@ip-172-31-5-57:~$ sudo du -ch -d 1 /var/lib/docker
9.9G /var/lib/docker/containers
8.0K /var/lib/docker/tmp
2.9M /var/lib/docker/image
60K /var/lib/docker/volumes
4.0K /var/lib/docker/trust
1.4G /var/lib/docker/aufs
60K /var/lib/docker/network
12G /var/lib/docker
12G total
screen shot 2016-06-02 at 6 22 40 am

from mongo.

yosifkit avatar yosifkit commented on June 9, 2024

Closing old issue. The solution is to either provide --logpath and --logappend via command line options or config file, or to configure docker log drivers as desired.

Related to #103 (comment).

from mongo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.