Fix logrotation rules
* explicitly specify the dirs that are getting rotated * app log rules are now moved to logrotate.ejs * we keep task logs for a week Some testing notes: * touch -d "10 days ago" foo * logrotate /etc/logrotate.conf -v to test rotation. there is a state file created in /var/lib/logrotate/status. If we have a 'daily' rule, it will get processed only after a log line in status exists and it's atleast 1 day old timestamp. https://github.com/logrotate/logrotate/blob/master/logrotate.c is quite readable
This commit is contained in:
+1
-1
@@ -232,7 +232,7 @@ function addLogrotateConfig(app, callback) {
|
||||
if (!runVolume) return callback(new Error('App does not have /run mounted'));
|
||||
|
||||
// logrotate configs can have arbitrary commands, so the config files must be owned by root
|
||||
var logrotateConf = ejs.render(LOGROTATE_CONFIG_EJS, { volumePath: runVolume.Source });
|
||||
var logrotateConf = ejs.render(LOGROTATE_CONFIG_EJS, { volumePath: runVolume.Source, appId: app.id });
|
||||
var tmpFilePath = path.join(os.tmpdir(), app.id + '.logrotate');
|
||||
fs.writeFile(tmpFilePath, logrotateConf, function (error) {
|
||||
if (error) return callback(error);
|
||||
|
||||
Reference in New Issue
Block a user