[SERVER-1865] Official Linux packages don't set up logrotate Created: 27/Sep/10  Updated: 06/Feb/23  Resolved: 06/Feb/23

Status: Closed
Project: Core Server
Component/s: Packaging, Stability
Affects Version/s: 1.6.3
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Chris Lea Assignee: [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
Resolution: Won't Do Votes: 22
Labels: sdp-backlog-purge
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian or Ubuntu systems using the official packages from the 10gen repositories.


Issue Links:
Backports
Duplicate
is duplicated by SERVER-16680 Include logrotate script for MongoDB Closed
is duplicated by SERVER-29963 Include log rotate scripts into deb a... Closed
Related
related to SERVER-4905 logRotate should conform to standard ... Closed
Assigned Teams:
Server Development Platform
Backport Requested:
v4.7, v4.4
Sprint: Dev Platform 2020-01-13, Dev Platform 2020-09-21, Dev Platform 2020-10-05, Dev Platform 2020-10-19, Dev Platform 2020-11-16
Participants:

 Description   

The Ubuntu and Debian packages don't add an entry to /etc/logrotate.d that rotates the logfile in /var/log/mongodb. So on a production system, the file /var/log/mongodb/mongodb.conf just grows unchecked. This will prove problematic for beginners who don't realize that's an issue until they suddenly run out of disk space. Something like this in /etc/logrotate.d should do it:

180:/var/log/mongodb# cat /etc/logrotate.d/mongodb
/var/log/mongodb/mongodb.log

{ daily missingok rotate 7 compress copytruncate notifempty create 640 root adm }

 Comments   
Comment by Iryna Zhuravlova [ 16/Nov/22 ]

After a careful backlog refinement, the team decided to close this ticket because of its low priority and limited resource capacity. If you believe that this ticket requires additional attention from the team and should be re-opened, feel free to change the status to "Needs Scheduling" and ping me or @alexander.neben

Comment by Connecting Media [ 10/Dec/19 ]

I am requesting for this to be prioritized as not automatically rotating and compressing logs is very unexpected behavior from a Debian/Ubuntu package.

This just adds serveral layers uf unnecessary complications for building images containing MongoDB and the like (at least for me)

Comment by Philipp Tkachev [ 03/Mar/17 ]

Guys, you need to build some sort of embedded scheduler, so DB can emulate cron and run scripts like logRotate() on server.
You already have TTL indexes, so there is something working on background and doing that stuff.

Comment by NOVALUE Mitar [ 16/Feb/14 ]

It is not clear if logappend is still needed with this or not? Documentation (http://docs.mongodb.org/manual/tutorial/rotate-log-files/) is here unclear. For me logrotate.d is an external program and it is not clear how it can or cannot interact with official log rotation provided by MongoDB. From what I understand, I can use logrotate.d when I am using syslog for logging, but otherwise I should send USR1 signals to mongod.

Comment by Ernie Hershey [ 21/Nov/13 ]

This seems sensible to be. The rpm's should do it too.

Here are some examples of other packages that do this:

Apache httpd
munin-server
munin-node
jenkins

Comment by Sebastian Paul [ 21/Nov/13 ]

i think this needs a higher priority, just had a server crash because of this.
You normally really expect that a package for a service like that should configure logrotate.
Especially if that service logs as much as mongod.

Also when you search the web you also don't get one qualified answer on how to set it up correctly.

Comment by Russell Smith [ 08/Nov/11 ]

/var/log/mongodb/*.log {
daily 
rotate 1095 # 3 years
dateext
copytruncate
delaycompress
compress
notifempty
extension gz
sharedscripts
missingok
# this is actually redundant
# postrotate
# /bin/kill -USR1 `cat /var/lib/mongodb/mongod.lock 2>/dev/null` 2> /dev/null|| true
# endscript
}

Reformatted for you.

Comment by Seamus Abshere [ 21/Apr/11 ]

For what it's worth, if you're using logrotate (the unix program), you don't need to send USR1... it's redundant.

  1. ubuntu log dir
    /var/log/mongodb/*.log { daily # 3 years rotate 1095 dateext copytruncate delaycompress compress notifempty extension gz sharedscripts missingok # this is actually redundant # postrotate # /bin/kill -USR1 `cat /var/lib/mongodb/mongod.lock 2>/dev/null` 2> /dev/null|| true # endscript }
Comment by Chris Lea [ 27/Sep/10 ]

Sorry. I didn't mean to mark this as "major". Please knock that down a few notches.

Generated at Thu Feb 08 02:58:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.