dynamoevents

package
v2.7.5+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultReadCapacityUnits specifies default value for read capacity units
	DefaultReadCapacityUnits = 10

	// DefaultWriteCapacityUnits specifies default value for write capacity units
	DefaultWriteCapacityUnits = 10

	// DefaultRetentionPeriod is a default data retention period in events table
	// default is 1 year
	DefaultRetentionPeriod = 365 * 24 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Region is where DynamoDB Table will be used to store k/v
	Region string `json:"region,omitempty"`
	// Tablename where to store K/V in DynamoDB
	Tablename string `json:"table_name,omitempty"`
	// ReadCapacityUnits is Dynamodb read capacity units
	ReadCapacityUnits int64 `json:"read_capacity_units"`
	// WriteCapacityUnits is Dynamodb write capacity units
	WriteCapacityUnits int64 `json:"write_capacity_units"`
	// RetentionPeriod is a default retention period for events
	RetentionPeriod time.Duration
	// Clock is a clock interface, used in tests
	Clock clockwork.Clock
}

Config structure represents DynamoDB confniguration as appears in `storage` section of Teleport YAML

func (*Config) CheckAndSetDefaults

func (cfg *Config) CheckAndSetDefaults() error

CheckAndSetDefaults is a helper returns an error if the supplied configuration is not enough to connect to DynamoDB

type Log

type Log struct {
	// Entry is a log entry
	*log.Entry
	// Config is a backend configuration
	Config
	// contains filtered or unexported fields
}

Log is a dynamo-db backed storage of events

func New

func New(cfg Config) (*Log, error)

New returns new instance of DynamoDB backend. It's an implementation of backend API's NewFunc

func (*Log) Close

func (b *Log) Close() error

Close the DynamoDB driver

func (*Log) EmitAuditEvent

func (l *Log) EmitAuditEvent(eventType string, fields events.EventFields) error

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

func (*Log) WaitForDelivery

func (l *Log) WaitForDelivery(ctx context.Context) error

WaitForDelivery waits for resources to be released and outstanding requests to complete after calling Close method

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL