Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-4799

System Logrotate integration

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: kb, production
    • Labels:
      None
    • 1

      Due to some known problems using logrotate (SERVER-14053) and thanks to the changes performed on SERVER-4905. The log rotation approach based on logrotate standard tool should be included in the documentation.

      The following is a logrotate configuration extracted from one of the comments on SERVER-14053.

      /var/log/mongodb/mongod.log {
        daily
        size 1G
        rotate 10
        missingok
        compress
        compresscmd /usr/bin/bzip2
        uncompresscmd /usr/bin/bunzip2
        compressoptions -9
        compressext .bz2
        delaycompress
        notifempty
        create 640 mongod mongod
        sharedscripts
        postrotate
            /bin/kill -SIGUSR1 `cat /var/run/mongodb/mongod.pid 2>/dev/null` >/dev/null 2>&1
            find /var/log/mongodb -type f -size 0 -regextype posix-awk -regex "^\/var\/log\/mongodb\/mongod\.log\.[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}-[0-9]{2}-[0-9]{2}$" -execdir rm {} \; >/dev/null 2>&1
        endscript
      }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            ricardo.lorenzo Ricardo Lorenzo
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              1 year, 15 weeks, 6 days ago