teleport/lib/events/discard.go
Ev Kontsevoy c7b4934553 Implemented a new Teleport option: "no recording"
Teleport configuration now has a new field: NoAudit (false by default,
which means audit is always on).

When this option is set, Teleport will not record events and will not
record sessions.

It's implemented by adding "DiscardLogger" which implements the same
interface as teh real logger, and it's plugged into the system instead.

NOTE: this option is not exposed in teleport in any way: no config file,
no switch, etc. I quickly needed it for Telecast.
2016-09-05 22:12:57 -07:00

30 lines
868 B
Go

package events
import (
"io"
"time"
"github.com/gravitational/teleport/lib/session"
)
// DiscardAuditLog is do-nothing, discard-everything implementation
// of IAuditLog interface used for cases when audit is turned off
type DiscardAuditLog struct {
}
func (d *DiscardAuditLog) EmitAuditEvent(eventType string, fields EventFields) error {
return nil
}
func (d *DiscardAuditLog) PostSessionChunk(sid session.ID, reader io.Reader) error {
return nil
}
func (d *DiscardAuditLog) GetSessionChunk(sid session.ID, offsetBytes, maxBytes int) ([]byte, error) {
return make([]byte, 0), nil
}
func (d *DiscardAuditLog) GetSessionEvents(sid session.ID, after int) ([]EventFields, error) {
return make([]EventFields, 0), nil
}
func (d *DiscardAuditLog) SearchEvents(fromUTC, toUTC time.Time, query string) ([]EventFields, error) {
return make([]EventFields, 0), nil
}