code: func (c *containerLogManager) removeExcessLogs(logs []string) ([]string, error) {
  	// Sort log files in oldest to newest order.
  	sort.Strings(logs)
  	// Container will create a new log file, and we'll rotate the latest log file.
  	// Other than those 2 files, we can have at most MaxFiles-2 rotated log files.
  	// Keep MaxFiles-2 files by removing old files.
  	// We should remove from oldest to newest, so as not to break ongoing `kubectl logs`.
  	maxRotatedFiles := c.policy.MaxFiles - 2
  	if maxRotatedFiles < 0 {
  		maxRotatedFiles = 0
  	}
  	i := 0
  	for ; i < len(logs)-maxRotatedFiles; i++ {
  		if err := os.Remove(logs[i]); err != nil {
  			return nil, fmt.Errorf("failed to remove old log %q: %v", logs[i], err)
  		}
  	}
  	logs = logs[i:]
  	return logs, nil
  }
docs: // removeExcessLogs removes old logs to make sure there are only at most MaxFiles log files.