Documentation ¶
Index ¶
- Variables
- func NewHook(c *Client) logrus.Hook
- func RegisterLogPipeServer(s *grpc.Server, srv LogPipeServer)
- type CLIOpt
- type Client
- type Config
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)
- func (m *Entry) GetAt() *types.Timestamp
- func (m *Entry) GetFields() *types.Struct
- func (m *Entry) GetLevel() int64
- func (m *Entry) GetMessage() string
- func (m *Entry) GetService() string
- func (m *Entry) Marshal() (dAtA []byte, err error)
- func (m *Entry) MarshalTo(dAtA []byte) (int, error)
- func (*Entry) ProtoMessage()
- func (m *Entry) Reset()
- func (m *Entry) Size() (n int)
- func (m *Entry) String() string
- func (m *Entry) Unmarshal(dAtA []byte) error
- func (m *Entry) XXX_DiscardUnknown()
- func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Entry) XXX_Merge(src proto.Message)
- func (m *Entry) XXX_Size() int
- func (m *Entry) XXX_Unmarshal(b []byte) error
- type Hook
- type LogData
- func (*LogData) Descriptor() ([]byte, []int)
- func (m *LogData) GetData() []byte
- func (m *LogData) GetPubKey() []byte
- func (m *LogData) GetSignature() []byte
- func (m *LogData) Marshal() (dAtA []byte, err error)
- func (m *LogData) MarshalTo(dAtA []byte) (int, error)
- func (*LogData) ProtoMessage()
- func (m *LogData) Reset()
- func (m *LogData) Size() (n int)
- func (m *LogData) String() string
- func (m *LogData) Unmarshal(dAtA []byte) error
- func (m *LogData) XXX_DiscardUnknown()
- func (m *LogData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LogData) XXX_Merge(src proto.Message)
- func (m *LogData) XXX_Size() int
- func (m *LogData) XXX_Unmarshal(b []byte) error
- type LogPipeClient
- type LogPipeServer
- type LogPipe_ReceiveLogsClient
- type LogPipe_ReceiveLogsServer
- type LoggerConfig
- type Reader
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthMessage = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMessage = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthServer = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowServer = fmt.Errorf("proto: integer overflow") )
var ErrBundleTooLarge = errors.New("log bundle is too large")
ErrBundleTooLarge indicates when the bundle has exceeded the limits the logpipe server has placed.
var ErrSpoolFull = errors.New("the spool is full, please retry later")
ErrSpoolFull is sent when the spool dir is full and no more logs can be accepted.
var ErrTooManyConnections = errors.New("too many connections, please retry later")
ErrTooManyConnections is thrown when the server is overloaded
var ErrTooMuchData = errors.New("too much data sent; please retry later")
ErrTooMuchData indicates when too much data has been sent.
Functions ¶
func RegisterLogPipeServer ¶
func RegisterLogPipeServer(s *grpc.Server, srv LogPipeServer)
Types ¶
type CLIOpt ¶
CLIOpt is used to parameterise NewCLILogger in an extensible fashion. For instance, to make JSON logging the default:
``` NewCLILogger(CLIOpt{Json:true}) ```
type Client ¶
type Client struct { Error error // contains filtered or unexported fields }
Client is a logging client that uses grpc to send a structured log.
type Config ¶
type Config struct { // ShowOurLogs determines whether or not to show our own diagnostic information. ShowOurLogs bool // DeliverLogs indicates whether or not logs should be delivered at all DeliverLogs bool // BackoffCap determines the maximum amount of time to wait in an backoff scenario. BackoffCap time.Duration // BackoffGranularity determines the time interval to use for calculating new backoff values BackoffGranularity time.Duration // TickInterval is the minimum/default amount of time to wait before waking up to deliver logs. TickInterval time.Duration }
Config is the configuration of the background logging services.
type Entry ¶
type Entry struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` Fields *types.Struct `protobuf:"bytes,2,opt,name=fields,proto3" json:"fields,omitempty"` At *types.Timestamp `protobuf:"bytes,3,opt,name=at,proto3" json:"at,omitempty"` Service string `protobuf:"bytes,4,opt,name=service,proto3" json:"service,omitempty"` Level int64 `protobuf:"varint,5,opt,name=level,proto3" json:"level,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Entry is a log message
func (*Entry) Descriptor ¶
func (*Entry) GetMessage ¶
func (*Entry) GetService ¶
func (*Entry) ProtoMessage ¶
func (*Entry) ProtoMessage()
func (*Entry) XXX_DiscardUnknown ¶
func (m *Entry) XXX_DiscardUnknown()
func (*Entry) XXX_Marshal ¶
func (*Entry) XXX_Unmarshal ¶
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook is a log emitter compatible with logrus; speaks to a client to send its data over the wire
type LogData ¶
type LogData struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` PubKey []byte `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty"` Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
LogData is the data to be shipped over the wire
func (*LogData) Descriptor ¶
func (*LogData) GetSignature ¶
func (*LogData) ProtoMessage ¶
func (*LogData) ProtoMessage()
func (*LogData) XXX_DiscardUnknown ¶
func (m *LogData) XXX_DiscardUnknown()
func (*LogData) XXX_Marshal ¶
func (*LogData) XXX_Unmarshal ¶
type LogPipeClient ¶
type LogPipeClient interface { // ReceiveLogs receives a stream of log data to later unpack and send to ES. ReceiveLogs(ctx context.Context, opts ...grpc.CallOption) (LogPipe_ReceiveLogsClient, error) }
LogPipeClient is the client API for LogPipe service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewLogPipeClient ¶
func NewLogPipeClient(cc *grpc.ClientConn) LogPipeClient
type LogPipeServer ¶
type LogPipeServer interface { // ReceiveLogs receives a stream of log data to later unpack and send to ES. ReceiveLogs(LogPipe_ReceiveLogsServer) error }
LogPipeServer is the server API for LogPipe service.
type LoggerConfig ¶
type LoggerConfig struct { logrus.Logger LogAddress string LogSpoolDir string LogLevelStr string LogCaller bool LogFile string // contains filtered or unexported fields }
LoggerConfig describes the configuration of logging for a program.
func NewCLILogger ¶
func NewCLILogger(serviceName string, opts CLIOpt) *LoggerConfig
NewCLILogger creates a new CLI logger. Specifically this: - adds CLI flags for configuring the logging system - instantiates a Logrus logger - returns a struct with CLI flags registered and ready to be parsed by flag.Parse
func (*LoggerConfig) ConfigureLogger ¶
func (c *LoggerConfig) ConfigureLogger() error
ConfigureLogger configures logging from command line parameters.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a reader for the structured log bundles. A "log bundle" is a stream of bytes consisting of a length prefix in int32 form, a padding int32, and the protobuf marshaled out. This pattern repeats itself until EOF. The marshaled proto is expected to unmarshal into the log.Entry type (see message.proto).
Reading the bundle is an act of instantiating this struct with NewReader() and calling NextProto() on the result until io.EOF is returned.