Documentation ¶
Overview ¶
Package firestoreeventsLog implements Firestore storage backend for Teleport event storage.
firestoreevents package implements the Log storage back-end for the auth server. Originally contributed by https://github.com/joshdurbin
Index ¶
- type EventsConfig
- type Log
- func (l *Log) Close() error
- func (l *Log) EmitAuditEvent(ev events.Event, fields events.EventFields) error
- func (l *Log) GetSessionChunk(namespace string, sid session.ID, offsetBytes, maxBytes int) ([]byte, error)
- func (l *Log) GetSessionEvents(namespace string, sid session.ID, after int, inlcudePrintEvents bool) ([]events.EventFields, error)
- func (l *Log) PostSessionSlice(slice events.SessionSlice) error
- func (l *Log) SearchEvents(fromUTC, toUTC time.Time, filter string, limit int) ([]events.EventFields, error)
- func (l *Log) SearchSessionEvents(fromUTC time.Time, toUTC time.Time, limit int) ([]events.EventFields, error)
- func (l *Log) UploadSessionRecording(events.SessionRecording) error
- func (l *Log) WaitForDelivery(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventsConfig ¶
type EventsConfig struct { firestorebk.Config // RetentionPeriod is a default retention period for events RetentionPeriod time.Duration // Clock is a clock interface, used in tests Clock clockwork.Clock // UIDGenerator is unique ID generator UIDGenerator utils.UID }
Config structure represents Firestore configuration as appears in `storage` section of Teleport YAML
func (*EventsConfig) SetFromParams ¶
func (cfg *EventsConfig) SetFromParams(params backend.Params) error
SetFromParams establishes values on an EventsConfig from the supplied params
func (*EventsConfig) SetFromURL ¶
func (cfg *EventsConfig) SetFromURL(url *url.URL) error
SetFromURL establishes values on an EventsConfig from the supplied URI
type Log ¶
type Log struct { // Entry is a log entry *log.Entry // Config is a backend configuration EventsConfig // contains filtered or unexported fields }
Log is a firestore-db backed storage of events
func New ¶
func New(cfg EventsConfig) (*Log, error)
New returns new instance of Firestore backend. It's an implementation of backend API's NewFunc
func (*Log) EmitAuditEvent ¶
EmitAuditEvent emits audit event
func (*Log) GetSessionChunk ¶
func (l *Log) GetSessionChunk(namespace string, sid session.ID, offsetBytes, maxBytes int) ([]byte, error)
GetSessionChunk returns a reader which can be used to read a byte stream of a recorded session starting from 'offsetBytes' (pass 0 to start from the beginning) up to maxBytes bytes.
If maxBytes > MaxChunkBytes, it gets rounded down to MaxChunkBytes
func (*Log) GetSessionEvents ¶
func (l *Log) GetSessionEvents(namespace string, sid session.ID, after int, inlcudePrintEvents bool) ([]events.EventFields, error)
Returns all events that happen during a session sorted by time (oldest first).
after tells to use only return events after a specified cursor Id
This function is usually used in conjunction with GetSessionReader to replay recorded session streams.
func (*Log) PostSessionSlice ¶
func (l *Log) PostSessionSlice(slice events.SessionSlice) error
PostSessionSlice sends chunks of recorded session to the event log
func (*Log) SearchEvents ¶
func (l *Log) SearchEvents(fromUTC, toUTC time.Time, filter string, limit int) ([]events.EventFields, error)
SearchEvents is a flexible way to find The format of a query string depends on the implementing backend. A recommended format is urlencoded (good enough for Lucene/Solr)
Pagination is also defined via backend-specific query format.
The only mandatory requirement is a date range (UTC). Results must always show up sorted by date (newest first)
func (*Log) SearchSessionEvents ¶
func (l *Log) SearchSessionEvents(fromUTC time.Time, toUTC time.Time, limit int) ([]events.EventFields, error)
SearchSessionEvents returns session related events only. This is used to find completed session.
func (*Log) UploadSessionRecording ¶
func (l *Log) UploadSessionRecording(events.SessionRecording) error