Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector is the top-level log ingestion entry point. It routes writes to an embedded RingBufferSink plus any extra sinks the caller provides.
func NewCollector ¶
func NewCollector(opts CollectorOptions) *Collector
NewCollector returns a Collector with the given capacity per stream.
type CollectorOptions ¶
CollectorOptions configures the LogCollector.
type FileRotator ¶
type FileRotator struct {
// contains filtered or unexported fields
}
FileRotator writes to an active log file and rotates it when the size cap is exceeded. Rotated files are named "<base>.<n>.log" for n = 1..MaxFiles-1.
func NewFileRotator ¶
func NewFileRotator(opts RotatorOptions) (*FileRotator, error)
NewFileRotator opens (creating if necessary) the active log file.
func (*FileRotator) Close ¶
func (r *FileRotator) Close() error
Close flushes and closes the active file.
type LogEntry ¶
type LogEntry struct {
ProcessID string
Stream uint8 // 0=stdout, 1=stderr, 2=diag
SeqNo uint64
Timestamp time.Time
Data []byte
}
LogEntry is one logical chunk of log data delivered to a Sink.
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is a byte-oriented circular buffer with FIFO eviction. All methods are safe for concurrent use.
func NewRingBuffer ¶
func NewRingBuffer(capacity int) *RingBuffer
NewRingBuffer returns a ring buffer with the given byte capacity.
func (*RingBuffer) Size ¶
func (r *RingBuffer) Size() int
Size returns the number of bytes currently buffered.
func (*RingBuffer) Snapshot ¶
func (r *RingBuffer) Snapshot() []byte
Snapshot returns a copy of the currently buffered bytes in FIFO order.
type RingBufferSink ¶
type RingBufferSink struct {
// contains filtered or unexported fields
}
RingBufferSink stores data per (process, stream) in RingBuffers.
func NewRingBufferSink ¶
func NewRingBufferSink(capacity int) *RingBufferSink
NewRingBufferSink returns a sink whose buffers have the given byte capacity.
func (*RingBufferSink) Close ¶
func (s *RingBufferSink) Close() error
func (*RingBufferSink) Flush ¶
func (s *RingBufferSink) Flush() error
func (*RingBufferSink) Snapshot ¶
func (s *RingBufferSink) Snapshot(processID string, stream uint8) []byte
Snapshot returns the current contents for (processID, stream) or nil.
func (*RingBufferSink) Write ¶
func (s *RingBufferSink) Write(e LogEntry) error
Write routes e to the appropriate ring buffer.