[DOCS-4799] System Logrotate integration Created: 09/Feb/15  Updated: 07/Jan/23  Resolved: 07/Jan/23

Status: Closed
Project: Documentation
Component/s: kb, production
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Ricardo Lorenzo Assignee: Unassigned
Resolution: Won't Do Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Participants:
Days since reply: 1 year, 4 weeks, 5 days ago
Story Points: 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
}



 Comments   
Comment by Rachelle Palmer [ 07/Jan/23 ]

Won't do/put on docs, but I will take this content and write something up for DevCenter.

Generated at Thu Feb 08 07:48:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.