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