-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Documentation for reading rotated logs using file log receiver #34833
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
There is some detailed documentation here which you may find helpful. In general, the design tries to make minimal assumptions about log rotation mechanics and instead relies on identifying files based on the first N bytes of the file, which should not change under rotation. (So the assumption is just that log files are append-only.)
On nix systems, we keep file handles open in between polls. Then we check if the same file was not found in the most recent poll. If not found, then we read the remainder of the file before closing it. This works quite well to ensure that files are consumed completely even in the scenario you describe. In theory, it's possible that a delayed write to the file may be missed, but at some point we must stop watching files that are moved out of the matching pattern. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Component(s)
receiver/filelog
Describe the issue you're reporting
The readme page of the file log receiver states that "File Log Receiver can read files that are being rotated." I am trying to read more about how it's done and whether there are any limitations.
Using Logrotate, for example, when rotating logs using create mode, it rotates the main log file by renaming the original one and creating a new one under the original name. If the process is actively writing to it while the file being rotated. Log might continue writing to the already rotated file. In a case like that,
This is probably a question for stackoverflow, but I either way, I would like some pointers to read more about the supporting of reading rotated files in general. Thank you.
The text was updated successfully, but these errors were encountered: