tail

package
v0.0.0-...-b962a07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package tail implements tailing a log file.

tail provides a channel on which log lines will be sent as string messages. one line in the log file is one message on the channel

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEntries

func GetEntries(ctx context.Context, conf Config) ([]chan string, error)

GetEntries sets up a list of channels that get one line at a time from each file down each channel.

func GetSampledEntries

func GetSampledEntries(ctx context.Context, conf Config, sampleRate uint) ([]chan string, error)

GetSampledEntries wraps GetEntries and returns a list of channels that provide sampled entries

Types

type Config

type Config struct {
	// Path to the log file to tail
	Paths []string
	// Type of log rotation we expect on this file
	Type RotateStyle
	// Tail specific options
	Options TailOptions
}

type RotateStyle

type RotateStyle int
const (
	// foo.log gets rotated to foo.log.1, new entries go to foo.log
	RotateStyleSyslog RotateStyle = iota
	// foo.log.OLDSTAMP gets closed, new entries go to foo.log.NEWSTAMP
	// NOT YET IMPLEMENTED
	RotateStyleTimestamp
)

type State

type State struct {
	INode  uint64 // the inode
	Offset int64
}

State is what's stored in a statefile

type TailOptions

type TailOptions struct {
	ReadFrom  string `` /* 276-byte string literal not displayed */
	Stop      bool   `` /* 160-byte string literal not displayed */
	Poll      bool   `long:"poll" description:"use poll instead of inotify to tail files"`
	StateFile string `` /* 178-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL