1![ci](https://github.com/nxadm/tail/workflows/ci/badge.svg)[![Go Reference](https://pkg.go.dev/badge/github.com/nxadm/tail.svg)](https://pkg.go.dev/github.com/nxadm/tail) 2 3# tail functionality in Go 4 5nxadm/tail provides a Go library that emulates the features of the BSD `tail` 6program. The library comes with full support for truncation/move detection as 7it is designed to work with log rotation tools. The library works on all 8operating systems supported by Go, including POSIX systems like Linux and 9*BSD, and MS Windows. Go 1.9 is the oldest compiler release supported. 10 11A simple example: 12 13```Go 14// Create a tail 15t, err := tail.TailFile( 16 "/var/log/nginx.log", tail.Config{Follow: true, ReOpen: true}) 17if err != nil { 18 panic(err) 19} 20 21// Print the text of each received line 22for line := range t.Lines { 23 fmt.Println(line.Text) 24} 25``` 26 27See [API documentation](https://pkg.go.dev/github.com/nxadm/tail). 28 29## Installing 30 31 go get github.com/nxadm/tail/... 32 33## History 34 35This project is an active, drop-in replacement for the 36[abandoned](https://en.wikipedia.org/wiki/HPE_Helion) Go tail library at 37[hpcloud](https://github.com/hpcloud/tail). Next to 38[addressing open issues/PRs of the original project](https://github.com/nxadm/tail/issues/6), 39nxadm/tail continues the development by keeping up to date with the Go toolchain 40(e.g. go modules) and dependencies, completing the documentation, adding features 41and fixing bugs. 42 43## Examples 44Examples, e.g. used to debug an issue, are kept in the [examples directory](/examples).