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

Copy before truncate not working. #591

Open
owilsonjunior opened this issue Mar 15, 2024 · 3 comments
Open

Copy before truncate not working. #591

owilsonjunior opened this issue Mar 15, 2024 · 3 comments

Comments

@owilsonjunior
Copy link

owilsonjunior commented Mar 15, 2024

Hi guys.
First of all, I apologize for the bad English...

I need some support in rotating the logs.

I use the configuration below for the standard rotation of the Tomcats I implement.

/opt/tomcat_planodesaude/logs/*.out  /opt/tomcat_planodesaude/logs/*.log {
    su tomcat tomcat
    missingok
    copytruncate
    daily
    rotate 7
}

For some time now, I've noticed a lot of data loss in the rotation that is created.
It's as if it only manages to rotate from the time the task starts until it finishes, not saving the log data from the last 24 hours as expected:

1

2

Note that the start date of the "copy" created and the end date are a little over 15 minutes apart.

Is there any way to ensure that it creates a copy of the data from the last 24 hours?

@cgzones
Copy link
Member

cgzones commented Mar 15, 2024

Maybe the problem is tomcat after the rotation still writing to the old offset; it might need a reload.
Does the log file contain more content than being saved just before the rotation?

@owilsonjunior
Copy link
Author

No, only that time interval and in the original file we have the continuation from the moment of truncate.

@owilsonjunior
Copy link
Author

Can we get around this?

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