// newStreamWriter creates a streamer that will be used to stream the
// requests that occur within this session to the audit log.
newStreamWriter creates a streamer that will be used to stream the
requests that occur within this session to the audit log.
// newStreamWriter creates a streamer that will be used to stream the // requests that occur within this session to the audit log .
func (s *Server) newStreamWriter(sessionCtx *session.Context) (libevents.StreamWriter, error) {
	clusterConfig, err := s.cfg.AccessPoint.GetClusterConfig()
	if err != nil {
		return nil, trace.Wrap(err)
	}
	streamer, err := s.newStreamer(s.closeContext, sessionCtx.ID, clusterConfig)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return libevents.NewAuditWriter(libevents.AuditWriterConfig{
		Context:      s.closeContext,
		Streamer:     streamer,
		Clock:        s.cfg.Clock,
		SessionID:    libsession.ID(sessionCtx.ID),
		Namespace:    defaults.Namespace,
		ServerID:     sessionCtx.Server.GetHostID(),
		RecordOutput: clusterConfig.GetSessionRecording() != services.RecordOff,
		Component:    teleport.ComponentDatabase,
	})
}
func ( s * Server ) newStreamWriter ( sessionCtx * session . Context ) ( libevents . StreamWriter , error ) { clusterConfig , err := s . cfg . AccessPoint . GetClusterConfig ( ) if err != nil { return nil , trace . Wrap ( err ) } streamer , err := s . newStreamer ( s . closeContext , sessionCtx . ID , clusterConfig ) if err != nil { return nil , trace . Wrap ( err ) } return libevents . NewAuditWriter ( libevents . AuditWriterConfig { Context : s . closeContext , Streamer : streamer , Clock : s . cfg . Clock , SessionID : libsession . ID ( sessionCtx . ID ) , Namespace : defaults . Namespace , ServerID : sessionCtx . Server . GetHostID ( ) , RecordOutput : clusterConfig . GetSessionRecording ( ) != services . RecordOff , Component : teleport . ComponentDatabase , } ) }
newStreamWriter creates a streamer that will be used to stream the
requests that occur within this session to the audit log.
newStreamWriter creates a streamer that will be used to stream the requests that occur within this session to the audit log .
// TODO(r0mant): Add support for record-at-proxy. // Create a sync or async streamer depending on configuration of cluster. // Audit stream is using server context, not session context, // to make sure that session is uploaded even after it is closed