Problems with nginx log separation

in the real world, because nginx generates a large number of logs, log files are separated on a daily basis.
I have a question: will the request log be lost when the log is being backed up and a new log file is created by nginx?

Apr.02,2021

how do you split it? Generally speaking, if you use shell to deal with it, there will be no loss.

if you use logrotate , it won't. Each file under
Linux comes with a file that indicates that inode,logrotate first renames the log file being written (usually adding the current date to the file name), but the inode of this file remains the same, so nginx still finds the file according to inode and writes it in.
then logrotate will tell nginx that a new log file needs to be opened for writing, and nginx will open a new log file for writing, with the same name as the original.
that's all.
you can read this article again how-logrotate-works .


Why write your own shell, if the nginx, you use for package management installation comes with logrotate configuration, you can edit it a little bit. Linux systems basically use their own logrotate scrolling logs

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b909-2c285.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b909-2c285.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?