Categorygithub.com/SEKOIA-IO/tail
modulepackage
1.6.0
Repository: https://github.com/sekoia-io/tail.git
Documentation: pkg.go.dev

# README

Go Reference ci FreeBSD

tail functionality in Go

SEKOIA-IO/tail provides a Go library that emulates the features of the BSD tail program. The library comes with full support for truncation/move detection as it is designed to work with log rotation tools. The library works on all operating systems supported by Go, including POSIX systems like Linux, *BSD, MacOS, and MS Windows. Go 1.12 is the oldest compiler release supported.

A simple example:

// Create a tail
t, err := tail.TailFile(
	"/var/log/nginx.log", tail.Config{Follow: true, ReOpen: true})
if err != nil {
    panic(err)
}

// Print the text of each received line
for line := range t.Lines {
    fmt.Println(line.Text)
}

See API documentation.

Installing

go get github.com/SEKOIA-IO/tail

History

This project is an active, drop-in replacement for the abandoned Go tail library at nxadm that itself is a fork of hpcloud.

Examples

Examples, e.g. used to debug an issue, are kept in the examples directory.

# Packages

No description provided by the author
No description provided by the author
Package ratelimiter implements the Leaky Bucket ratelimiting algorithm with memcached and in-memory backends.
No description provided by the author
Copyright (c) 2019 FOSS contributors of https://github.com/SEKOIA-IO/tail.

# Functions

Deprecated: this function is no longer used internally and it has little of no use in the API.
Deprecated: this function is only useful internally and, as such, it will be removed from the API in a future major release.
TailFile begins tailing the file.

# Variables

DefaultLogger logs to os.Stderr and it is used when Config.Logger == nil.
DiscardingLogger can be used to disable logging output.
ErrStop is returned when the tail of a file has been marked to be stopped.

# Structs

Config is used to specify how a file must be tailed.
No description provided by the author
SeekInfo represents arguments to io.Seek.
No description provided by the author