private long filterAndSize(Path originalLogFile) throws IOException {
    long size = 0;
    logFilter.startNewFile();

    try (BufferedReader reader = new BufferedReader(new FileReader(originalLogFile.toFile()))) {
      String line;
      while ((line = reader.readLine()) != null) {
        LogFilter.LineFilterResult result = logFilter.acceptsLine(line);

        if (result == LogFilter.LineFilterResult.REMAINDER_OF_FILE_REJECTED) {
          break;
        }
        if (result == LogFilter.LineFilterResult.LINE_ACCEPTED) {
          size += line.length() + System.lineSeparator().length();
        }
      }
    }
    return size;
  }
@return size of file in bytes
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/util/LogExporter.java