It basically works like this (
@repeatedly please correct me if I am wrong)
- Files are monitored over every change (data modification, renamed, deleted)
- When a monitored file is renamed, it's considered a "rotation" if the inode number is always the same.
- File rotated keeps being monitored until "rotate_wait" expires (every 5 seconds by default)
- Fluentd in the meanwhile is scanning the monitored "path" for new file additions every "refresh_interval" expiration.
- If a new file with the same name of the original rotated file appears (and have a different inode number), is tailed from the beginning.
So from a configuration perspective rotate_wait and refresh_interval values are the key to manage rotated files properly, if you have a high frequency of rotated files, make sure to have a low refresh_interval value so Fluent can trap these changes.