question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Log files not rotating after exceeding maxsize threshold

See original GitHub issue

I set my maxsize in a congif file as 300 and my code is the following:

'use strict'

import winston from 'winston'
import config from '../../config/environment'

export default winston.createLogger({
  level: 'info',
  format: winston.format.printf(info => info.message),
  transports: [
    new winston.transports.Console(),
    new winston.transports.File({
      filename: `${config.logsPath}/express.error.log`,
      maxsize: config.logMaxSize,
      level: 'error'
    }),
    new winston.transports.File({
      filename: `${config.logsPath}/express.log`,
      maxsize: config.logMaxSize
    })]
})

None of this files are rotating after they reach the 300 bytes threshold.

I even tried setting the 300 manually instead of making a reference to the config file.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
indexzerocommented, Apr 26, 2018

Yes maxsize should 100% work as expected – we added tests for this feature in https://github.com/winstonjs/winston/pull/1236

1reaction
nenginecommented, Oct 11, 2017

Aha Ok Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Logrotate not rotating file after file size exceeds the limit.
According to the man page, logrotate should rotate file if the configuration is based on logs size. But, my file is not getting...
Read more >
Winston js. My log files aren't rotating after exceeding maxsize
Basically, once over the maxsize threshold, internal self.filename variable was not being updated so _createStream would re-open the append ...
Read more >
Logrotate daily+maxsize is not rotating - Unix StackExchange
I want the log to be rotated daily or if the size reaches 50MB. When this happens log files are compressed and copied...
Read more >
Why logrotate maxsize condition is not working? - Super User
In the logrotate manual page there is no "maxsize" option, just "size" and "minsize". enter image description here.
Read more >
How to Rotate and Compress Log Files in Linux with Logrotate
The statement implies that log files bigger than 40 Megabytes will be rotated without any regard for the time interval of rotation. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found