public static String tailSystemLog(File logFile, final int numLines) throws IOException {
    if (logFile == null || logFile.equals(new File(""))) {
      return null;
    }
    int maxBuffer = 65500; // DataOutput.writeUTF will only accept 65535 bytes
    long fileLength = logFile.length();
    if (fileLength == 0) {
      return null;
    }
    byte[] buffer = (fileLength > maxBuffer) ? new byte[maxBuffer] : new byte[(int) fileLength];

    int readSize = buffer.length;
    RandomAccessFile f = new RandomAccessFile(logFile, "r");

    int linesRead = 0;
    long seekPosition = fileLength - readSize;
    StringBuilder returnStr = new StringBuilder();
    StringBuilder workingString = new StringBuilder();
    String separator = lineSeparator();

    while (linesRead < numLines) {

      f.seek(seekPosition);
      f.read(buffer, 0, readSize);

      workingString.insert(0, new String(buffer, 0, readSize));

      String[] splits = workingString.toString().split("\\r?\\n");

      // The first element may be part of a line, so we don't count that
      // but we need to save it for the next time around.
      if (splits.length > 1) {
        for (int i = splits.length - 1; i > 0; i--) {
          returnStr.insert(0, separator).insert(0, splits[i]);
          if (++linesRead >= numLines) {
            break;
          }
        }
      }

      if (seekPosition == 0 && linesRead < numLines) {
        returnStr.insert(0, separator).insert(0, splits[0]);
        break;
      }

      workingString = new StringBuilder(splits[0]);

      if (readSize < seekPosition) {
        seekPosition = seekPosition - readSize;
      } else {
        readSize = (int) seekPosition;
        seekPosition = 0;
      }
    }

    f.close();

    returnStr.insert(0, separator).insert(0, "SystemLog:");

    return returnStr.toString();
  }
returns the tail of the log file

@return tail of the log file
geode-core/src/main/java/org/apache/geode/management/internal/beans/BeanUtilFuncs.java