The primary purpose of File::Tail is reading and analysing log files while they are being written, which is especialy usefull if you are monitoring the logging process with a tool like Tobias Oetiker's MRTG.
The module tries very hard NOT to "busy-wait" on a file that has little traffic. Any time it reads new data from the file, it counts the number of new lines, and divides that number by the time that passed since data were last written to the file before that. That is considered the average time before new data will be written. When there is no new data to read, 'File::Tail' sleeps for that number of seconds. Thereafter, the waiting time is recomputed dynamicaly. Note that 'File::Tail' never sleeps for more than the number of seconds set by 'maxinterval'.
If the file does not get altered for a while, 'File::Tail' gets suspicious and startschecking if the file was truncated, or moved and recreated. If anything like that had happened, 'File::Tail' will quietly reopen the file, and continue reading. The only way to affect what happens on reopen is by setting the reset_tail parameter (see below). The effect of this is that the scripts need not be aware when the logfiles were rotated, they will just quietly work on.
Note that the sleep and time used are from Time::HiRes, so this module should do the right thing even if the time to sleep is less than one second.
The logwatch script (also included) demonstrates several ways of calling the methods.
Package Version | Update ID | Released | Package Hub Version | Platforms | Subpackages |
---|---|---|---|---|---|
1.3-bp156.3.1 info | GA Release | 2023-07-22 | 15 SP6 |
|
|
1.3-bp155.2.9 info | GA Release | 2023-05-17 | 15 SP5 |
|
|
1.3-bp154.1.19 info | GA Release | 2022-05-09 | 15 SP4 |
|
|
1.3-bp153.1.14 info | GA Release | 2021-03-06 | 15 SP3 |
|
|
1.3-bp152.3.13 info | GA Release | 2020-04-16 | 15 SP2 |
|
|
1.3-bp151.3.1 info | GA Release | 2019-07-17 | 15 SP1 |
|
|
1.3-bp151.2.12 info | GA Release | 2019-05-18 | 15 SP1 |
|
|
1.3-bp150.2.4 info | GA Release | 2018-07-30 | 15 |
|
|