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

pygtail does not properly follow rotated files that are immediately compressed. #15

Open
synapsechris opened this issue Jan 10, 2015 · 8 comments

Comments

@synapsechris
Copy link

I had logrotate.d configured to immediately compress the old files on rotate.

I was using pygtail with logster.

I find that when logrotate.d did it's deed, then pygtail would recognize the rotation but then barf trying to read the last few "lines" from the newly compressed file. At this point it would fail to follow the new file. Deletion of the state file would fix the problem.

I believe that using "delaycompress" within your log rotate.d recipe may solve this ( I'll need to wait a while for proof ).

I'm not sure it will be possible for the pygtail code to follow into the compressed file in this situation. However it might be able to recognize what has happened, and print out sternish warning into it's OWN log that the use of delaycompress might solve the problem. It should also be smart enough to reset it's state and move on.

@bgreenlee
Copy link
Owner

Ack. I'll take a look at it when I get a chance. At the very least, if we can't figure it out, I'll update the README with a note of warning.

@aackerson
Copy link

Has this issue been addressed?

@bgreenlee
Copy link
Owner

Sorry, not yet, and I'm on vacation at the moment. It's on my todo list. In the meantime, PRs appreciated!

@trixpan
Copy link

trixpan commented Sep 4, 2015

I'm happy to have a go trying to fix this but was wondering if any of you could paste in here what the logrotate.d looks like?

@GilAdirim
Copy link

I seem to be having a similar problem. Here's an example of my logrotate settings:
`/var/log/engineyard/apps//.log {

daily

rotate 30

dateext

compress



missingok

notifempty

sharedscripts

extension gz

copytruncate

}`

P.S. @synapsechris did delaycompress resolve the issue?

@PeteClapham
Copy link

Hello guys,
I think I'm hitting the same issue. Did this go away in a later release or is it on the todo list ?

@bgreenlee
Copy link
Owner

It's still on the todo list. I don't think there's a good fix for it other than just using delaycompress.

@PeteClapham
Copy link

ok, I was attempting to use this on a system with logs rotated within the application (read closed source). Looks like this may not work out. I'll see if a delay within the pygtail script may help

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

6 participants