Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

tail rotated log files #5

Closed
eskornev opened this issue Nov 14, 2017 · 5 comments · Fixed by #8
Closed

tail rotated log files #5

eskornev opened this issue Nov 14, 2017 · 5 comments · Fixed by #8

Comments

@eskornev
Copy link

Hello!
Does stream_exporter tail mode supports file rotation?
I tried to attach log directory and made tail to one of them.
Then file was rotated, after that tail filter did not reacted on trigger words not in new log file nor in rotated.

@carlpett
Copy link
Owner

Hi!
Yes, this is supported, and has worked in my tests, at least. How did you rotate the file?

@eskornev
Copy link
Author

eskornev commented Nov 14, 2017

log dir was attached to docker with exporter, and on host machine was made:

mv ./sys.log ./sys.log1 && touch ./sys.log && chown user:user ./sys.log

exporter writed to log:

2017/11/14 14:59:18 Re-opening moved/deleted file ./sys.log ...
2017/11/14 14:59:18 Waiting for ./sys.log to appear...

when insert needed lines to new file then counter in localhost:9178/metrics doesn't add up

also I reproduced it without docker on my machine

thanks!

@carlpett
Copy link
Owner

Hm, that is odd. I wonder if it is something to do with the permissions being wrong initially? I've been using logrotate, and that has worked for me, at least.
What OS are you using?

@eskornev
Copy link
Author

eskornev commented Nov 14, 2017

maybe logrotate worked with truncate but not mv?
os is ubuntu 16.04 on all hosts, all files are rw-rw-r-- and owned by one user

maybe cause is somewhere in here:
hpcloud/tail#122

@carlpett
Copy link
Owner

Sorry that this has been hanging open for a while. I've spent a bit of time investigating this now, and the root of the issue appears to be a few layers down, in the fsnotify library: fsnotify/fsnotify#194.
There is a pull request which for some reason has not been merged that fixes this. I've manually merged it and am testing it out. Looks very promising so far.

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

Successfully merging a pull request may close this issue.

2 participants