Keep same file name for log and rotate the file with timestamp
See original GitHub issueI’m using winston@3.3.3 and winston-daily-rotate-file@4.5.0 In my logger configuration I have the following.
var transportError = new (winston.transports.DailyRotateFile)({
filename: HOME_DIR + '/logs/backend/error/error-%DATE%.log',
datePattern: 'YYYY-MM-DD-HH',
zippedArchive: false,
maxSize: '50m',
maxFiles: '14d',
level: 'error',
name: 'error',
createSymlink: true,
symlinkName: 'error.log',
tailable: true,
handleExceptions: true,
json: true,
colorize: false,
});
this is supposed to be like current log file should be error.log and when rotates it should get append with date format
even though I have mentioned createSymlink, tailable set to true symlinkName with ‘error.log’ my current log files are like this error-2021-02-01-13.log, error-2021-02-01-12.log
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Rotate log files with timestamp in file name - Server Fault
If you're already creating the files with the date in the name, logrotate isn't the answer; it is based around the idea of...
Read more >Logrotate files with date in the file name - Stack Overflow
Logrotate will only perform the operations it has been configured to perform. If you specify a daily rotate, it will not rotate again...
Read more >How to Manage Log Files Using Logrotate - Datadog
Log rotation, which is managed by tools like logrotate, solves these problems by performing routine maintenance on log files. Rotation refers to ...
Read more >Timestamp based target log file name configuration in logrotate
Description of problem: According to the "logrotate" manual page there do exist the following directives to influence the file name of the rotated...
Read more >Rotate Log Files — MongoDB Manual
Rotating log files does not modify the "old" rotated log files. When you rotate a log, you rename the server1.log file to include...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t want to config my elastic search to watch the file with pattern. I thing its very important to have the current file without any pattern
I don’t understand the symlink options. Why not have the current file without any date/number and just apply them after a rotation? That’s what I need and what I had used in other languages. IMHO the mentioned options over-complicate the usage.