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

System Logrotate integration

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Major - P3 Major - P3
    • None
    • None
    • kb, production
    • None
    • 1

    Description

      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
      }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              1 year, 4 weeks, 4 days ago