2015-09-30 22:48:17 +08:00
|
|
|
[![Build Status](https://travis-ci.org/hpcloud/tail.svg)](https://travis-ci.org/ActiveState/tail)
|
2014-03-22 13:02:52 +08:00
|
|
|
|
2013-02-05 10:59:04 +08:00
|
|
|
# Go package for tail-ing files
|
2012-10-13 00:05:11 +08:00
|
|
|
|
2013-02-05 10:59:04 +08:00
|
|
|
A Go package striving to emulate the features of the BSD `tail` program.
|
2012-10-13 00:05:11 +08:00
|
|
|
|
|
|
|
```Go
|
2013-02-06 10:49:32 +08:00
|
|
|
t, err := tail.TailFile("/var/log/nginx.log", tail.Config{Follow: true})
|
2012-10-13 00:05:11 +08:00
|
|
|
for line := range t.Lines {
|
|
|
|
fmt.Println(line.Text)
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-09-30 22:48:17 +08:00
|
|
|
See [API documentation](http://godoc.org/github.com/hpcloud/tail).
|
2013-03-11 06:01:42 +08:00
|
|
|
|
2013-05-30 07:32:01 +08:00
|
|
|
## Log rotation
|
2012-10-18 02:56:54 +08:00
|
|
|
|
2013-05-30 07:32:01 +08:00
|
|
|
Tail comes with full support for truncation/move detection as it is
|
|
|
|
designed to work with log rotation tools.
|
2012-10-18 02:56:54 +08:00
|
|
|
|
2013-05-30 07:32:01 +08:00
|
|
|
## Installing
|
2012-10-18 02:56:54 +08:00
|
|
|
|
2015-09-30 22:48:17 +08:00
|
|
|
go get github.com/hpcloud/tail/...
|
2012-10-18 02:56:54 +08:00
|
|
|
|
2015-07-04 07:19:37 +08:00
|
|
|
## Windows support
|
|
|
|
|
2015-09-30 22:48:17 +08:00
|
|
|
This package [needs assistance](https://github.com/hpcloud/tail/labels/Windows) for full Windows support.
|