Skip to content

Commit

Permalink
Don't emit logs on Cloud. (#39462)
Browse files Browse the repository at this point in the history
Updated `events.LoggingEmitter` to detect if running on Cloud both
cluster features and modules.
  • Loading branch information
russjones authored Mar 17, 2024
1 parent 5c06dd0 commit e9e16ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/events/emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ func (w *WriterEmitter) EmitAuditEvent(ctx context.Context, event apievents.Audi
// NewLoggingEmitter returns an emitter that logs all events to the console
// with the info level. Events are only logged for self-hosted installations,
// Teleport Cloud treats this as a no-op.
func NewLoggingEmitter() *LoggingEmitter {
func NewLoggingEmitter(cloud bool) *LoggingEmitter {
return &LoggingEmitter{
emit: !modules.GetModules().Features().Cloud,
emit: !(modules.GetModules().Features().Cloud || cloud),
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ func (process *TeleportProcess) initAuthService() error {
}

checkingEmitter, err := events.NewCheckingEmitter(events.CheckingEmitterConfig{
Inner: events.NewMultiEmitter(events.NewLoggingEmitter(), emitter),
Inner: events.NewMultiEmitter(events.NewLoggingEmitter(process.getClusterFeatures().Cloud), emitter),
Clock: process.Clock,
ClusterName: clusterName,
})
Expand Down Expand Up @@ -2459,7 +2459,7 @@ func (process *TeleportProcess) proxyPublicAddr() utils.NetAddr {
// It is caller's responsibility to call Close on the emitter once done.
func (process *TeleportProcess) NewAsyncEmitter(clt apievents.Emitter) (*events.AsyncEmitter, error) {
emitter, err := events.NewCheckingEmitter(events.CheckingEmitterConfig{
Inner: events.NewMultiEmitter(events.NewLoggingEmitter(), clt),
Inner: events.NewMultiEmitter(events.NewLoggingEmitter(process.getClusterFeatures().Cloud), clt),
Clock: process.Clock,
})
if err != nil {
Expand Down

0 comments on commit e9e16ba

Please sign in to comment.