juju: github.com/juju/juju/api/logstream Index | Files

package logstream

import "github.com/juju/juju/api/logstream"

Index

Package Files

logstream.go

type LogStream Uses

type LogStream struct {
    // contains filtered or unexported fields
}

LogStream streams log entries of the /logstream API endpoint over a websocket connection.

func Open Uses

func Open(conn base.StreamConnector, cfg params.LogStreamConfig, controllerUUID string) (*LogStream, error)

Open opens a websocket to the API's /logstream endpoint and returns a stream of log records from that connection.

func (*LogStream) Close Uses

func (ls *LogStream) Close() error

Close closes the stream.

func (*LogStream) Next Uses

func (ls *LogStream) Next() ([]logfwd.Record, error)

Next returns the next batch of log records from the server. The records are converted from the wire format into logfwd.Record. The first returned record will be the one after the last successfully sent record. If no records have been sent yet then it will be the oldest log record.

An error indicates either the streaming connection is closed, the connection failed, or the data read from the connection is corrupted. In each of these cases the stream should be re-opened. It will start at the record after the one marked as successfully sent. So the the record at which Next() failed previously will be streamed again.

That is only a problem when the same record is consistently streamed as invalid data. This will happen only if the record was invalid before being stored in the DB or if the DB on-disk storage for the record becomes corrupted. Both scenarios are highly unlikely and the respective systems are managed such that neither should happen.

Package logstream imports 10 packages (graph) and is imported by 16 packages. Updated 2019-08-25. Refresh now. Tools for package owners.