Configure NodeBB/winston/logrotate to create more log files



  • These are the contents of my logs folder:

    [ec2-user@ip-XX-XX-XX-XX logs]$ ls
    output.log  output.log.0.gz  output.log.1.gz  webinstall.log
    

    This gives me about 2h30-3h of server logs so any errors that occurred before this interval are lost. I'm running NodeBB 1.9.1 and I have a custom NodeBB plugin that runs some stuff. It is responsible for most of the logging as well as the crashes that I'm currently experiencing.

    How can I make NodeBB to create more log files, i.e., output.log.2.gz, output.log.3.gz, etc?


  • Global Moderator

    You can create a cron job to copy the file every hour.



  • I suppose the setting that I'm referring to is located in loader.js:

    var logrotate = require('logrotate-stream');
    ...
    var outputLogFilePath = path.join(__dirname, 'logs/output.log');
    var output = logrotate({ file: outputLogFilePath, size: '1m', keep: 3, compress: true });
    

    It would be nice if we could customize these parameters.


 

| |