https://github.com/powerman/tail
Go package tail implements behaviour of `tail -F` to follow rotated log files
https://github.com/powerman/tail
go golang golang-library golang-package tail
Last synced: 8 months ago
JSON representation
Go package tail implements behaviour of `tail -F` to follow rotated log files
- Host: GitHub
- URL: https://github.com/powerman/tail
- Owner: powerman
- License: mit
- Created: 2018-11-25T19:12:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-20T15:59:48.000Z (almost 3 years ago)
- Last Synced: 2025-05-06T03:58:07.537Z (8 months ago)
- Topics: go, golang, golang-library, golang-package, tail
- Language: Go
- Size: 484 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go package tail implements behaviour of `tail` tool
[](https://pkg.go.dev/github.com/powerman/tail)
[](https://github.com/powerman/tail/actions?query=workflow%3ACI%2FCD)
[](https://coveralls.io/github/powerman/tail?branch=master)
[](https://goreportcard.com/report/github.com/powerman/tail)
[](https://github.com/powerman/tail/releases/latest)
Go package tail implements behaviour of `tail -n 0 -F path` to follow
rotated log files using polling.
Most existing solutions for Go have race condition issues and occasionally
may lose lines from tracked file - such bugs are hard to fix without
massive changes in their architecture, so it turns out to be easier to
reimplement this functionality from scratch to make it work reliable and
don't lose data.
This package tries to log messages in same way as `tail`.
Unlike `tail` tool it does track renamed/removed file contents up to the
moment new file will be created with original name - this ensure no data
will be lost in case log rotation is done by external tool (i.e. not the
one which write to log file) and thus original log file may be appended
between rename/removal and reopening.
Unlike `tail` it does not support file truncation. While this can't work
reliable, truncate support may be added in the future.
## Installation
```
go get github.com/powerman/tail
```