code: func (l *Log) GetSessionEvents(namespace string, sid session.ID, after int, inlcudePrintEvents bool) ([]events.EventFields, error) {
  	var values []events.EventFields
  	query := "SessionID = :sessionID AND EventIndex >= :eventIndex"
  	attributes := map[string]interface{}{
  		":sessionID":  string(sid),
  		":eventIndex": after,
  	}
  	attributeValues, err := dynamodbattribute.MarshalMap(attributes)
  	input := dynamodb.QueryInput{
  		KeyConditionExpression:    aws.String(query),
  		TableName:                 aws.String(l.Tablename),
  		ExpressionAttributeValues: attributeValues,
  	}
  	out, err := l.svc.Query(&input)
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  	for _, item := range out.Items {
  		var e event
  		if err := dynamodbattribute.UnmarshalMap(item, &e); err != nil {
  			return nil, trace.BadParameter("failed to unmarshal event for session %q: %v", string(sid), err)
  		}
  		var fields events.EventFields
  		data := []byte(e.Fields)
  		if err := json.Unmarshal(data, &fields); err != nil {
  			return nil, trace.BadParameter("failed to unmarshal event for session %q: %v", string(sid), err)
  		}
  		values = append(values, fields)
  	}
  	sort.Sort(events.ByTimeAndIndex(values))
  	return values, nil
  }
docs: // 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.