code: func NewDiskSessionLogger(cfg DiskSessionLoggerConfig) (*DiskSessionLogger, error) {
  	if err := cfg.CheckAndSetDefaults(); err != nil {
  		return nil, trace.Wrap(err)
  	}
  	var err error
  
  	sessionDir := filepath.Join(cfg.DataDir, cfg.ServerID, SessionLogsDir, cfg.Namespace)
  	indexFile, err := os.OpenFile(
  		filepath.Join(sessionDir, fmt.Sprintf("%v.index", cfg.SessionID.String())), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0640)
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  
  	sessionLogger := &DiskSessionLogger{
  		DiskSessionLoggerConfig: cfg,
  		Entry: log.WithFields(log.Fields{
  			trace.Component: teleport.ComponentAuditLog,
  			trace.ComponentFields: log.Fields{
  				"sid": cfg.SessionID,
  			},
  		}),
  		sessionDir:     sessionDir,
  		indexFile:      indexFile,
  		lastEventIndex: -1,
  		lastChunkIndex: -1,
  	}
  	return sessionLogger, nil
  }
docs: // NewDiskSessionLogger creates new disk based session logger