Filetrack
Filetrack is a library for persistent reading of logs similar to the mechanisms used in Filebeat and other software alike. It provides a few useful primitives for working with IO and its main intention is to be used for implementation of custom log processors.
-
Multireaderthat lets you work with a list of readers as if you had one single buffer. -
InodeAwareReaderthat allows working with rotated logs and maintating persistent offset inside them. Scheme of persistence is to be implemented by user. -
TrackedReaderthat allows to read logs or any other content from rotated files with offset persisted across restarts inside a file in case you want a ready-to-use structure.
Example
Read a file line-by-line keeping track of current offset so that you could start where you left off next time. Note that the library
does not force you to use this scheme, you can implement your own persistence scheme using InodeAwareReader.
use ;
use BufRead;
// running this script will fetch and print new lines on each execution
See documentation for more examples and working principles.