Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Message
- type MultiFileWriter
- type Options
- type Sink
- func (s *Sink) Category() api.Category
- func (s *Sink) Config() interface{}
- func (s *Sink) Consume(batch api.Batch) api.Result
- func (s *Sink) Init(context api.Context) error
- func (s *Sink) SetCodec(c codec.Codec)
- func (s *Sink) Start() error
- func (s *Sink) Stop()
- func (s *Sink) String() string
- func (s *Sink) Type() api.Type
- type Writer
Constants ¶
View Source
const Type = "file"
Variables ¶
View Source
var (
LineEnding = []byte("\n")
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // WorkerCount is the number of concurrent goroutines writing files WorkerCount int `yaml:"workerCount,omitempty" default:"1"` // BaseDirs is a collection of directories that specify which directories to // write to, usually used when mounting a disk, and can be empty BaseDirs []string `yaml:"baseDirs,omitempty"` // DirHashKey DirHashKey string `yaml:"dirHashKey,omitempty"` // Filename is the file to write logs to. Backup log files will be retained // in the same directory. Filename string `yaml:"filename,omitempty" validate:"required"` // MaxSize is the maximum size in megabytes of the log file before it gets // rotated. It defaults to 100 megabytes. MaxSize int `yaml:"maxSize,omitempty" default:"100"` // MaxAge is the maximum number of days to retain old log files based on the // timestamp encoded in their filename. Note that a day is defined as 24 // hours and may not exactly correspond to calendar days due to daylight // savings, leap seconds, etc. The default is not to remove old log files // based on age. MaxAge int `yaml:"maxAge,omitempty"` // MaxBackups is the maximum number of old log files to retain. The default // is to retain all old log files (though MaxAge may still cause them to get // deleted.) MaxBackups int `yaml:"maxBackups,omitempty"` // LocalTime determines if the time used for formatting the timestamps in // backup files is the computer's local time. The default is to use UTC // time. LocalTime bool `yaml:"localTime,omitempty"` // Compress determines if the rotated log files should be compressed // using gzip. The default is not to perform compression. Compress bool `yaml:"compress,omitempty"` }
type MultiFileWriter ¶
type MultiFileWriter struct {
// contains filtered or unexported fields
}
func NewMultiFileWriter ¶
func NewMultiFileWriter(opt *Options) (*MultiFileWriter, error)
func (*MultiFileWriter) Close ¶
func (w *MultiFileWriter) Close() error
func (*MultiFileWriter) Write ¶
func (w *MultiFileWriter) Write(msgs ...Message) error
type Writer ¶
type Writer struct { // This field is required. W io.Writer // Size specifies the maximum amount of data the writer will buffered // before flushing. // // Defaults to 256 kB if unspecified. Size int // AutoFlushDisabled whether to disable automatic flush AutoFlushDisabled bool // FlushInterval specifies how often the writer should flush data if // there have been no writes. // // Defaults to 30 seconds if unspecified. FlushInterval time.Duration // contains filtered or unexported fields }
func (*Writer) Stop ¶
Stop closes the buffer, cleans up background goroutines, and flushes remaining unwritten data.
Click to show internal directories.
Click to hide internal directories.