Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if prerotate return error, the log is not dumped and the log package will be renamed #498

Closed
banjiuqingshan opened this issue Mar 17, 2023 · 3 comments

Comments

@banjiuqingshan
Copy link

21DEC767-4A30-4484-92FA-651D17CFD0D0
And we will lose the previous log

@cgzones
Copy link
Member

cgzones commented Mar 18, 2023

This is indeed the current behavior.
The loss of the previous log file in your examples is caused by overriding the log file via dd(1), otherwise it would have been preserved.
I am not sure what the historic reason is to rotate the old logs first, then run the prerotate script and then rotate the current log file; and I am also not sure if we should reorder it now.
Probably we could improve the documentation about this behavior:

logrotate/logrotate.8.in

Lines 667 to 668 in be6a263

the second argument to the \fBpostrotate\fR script. If the scripts exit with
error, the remaining actions will not be executed for the affected log only.

@banjiuqingshan
Copy link
Author

The original log will not be changed. I mean that logs that have been rotated will be renamed and overwritten, similar to test.log.3.gz, which will be renamed to test.log.4.gz, and then lost. In fact, all historical logs will be lost after several more executions. Can we reorder them or resume operations on the logs after the execution fails

banjiuqingshan added a commit to banjiuqingshan/logrotate that referenced this issue Mar 22, 2023
resume logs if prerotate script fails.logrotate#498
@banjiuqingshan
Copy link
Author

The issue has been resolved by fd1892e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants