public String getMRTaskLog(String mrJobId, String mrTaskId) {
    String mrTaskHistoryURL =
        "http://" + jhistoryAddr + "/ws/v1/history/mapreduce/jobs/" + mrJobId + "/tasks/" + mrTaskId + "/attempts";
    ;
    try {
      JsonNode response = fetchJson(new URL(mrTaskHistoryURL));
      int attempts = response.get("taskAttempts").get("taskAttempt").size();
      int maxattempt = 0;
      int maxattemptid = 0;
      for (int i = 0; i < attempts; i++) {
        int attempt = Integer
            .parseInt(response.get("taskAttempts").get("taskAttempt").get(i).get("id").getTextValue().split("_")[5]);
        if (attempt > maxattempt) {
          maxattemptid = i;
          maxattempt = attempt;
        }
      }
      return response.get("taskAttempts").get("taskAttempt").get(maxattemptid).get("diagnostics").getTextValue();
    } catch (MalformedURLException e) {
      logger.error(e.toString());
    } catch (IOException e) {
      logger.error(e.toString());
    }
    return null;
  }
Returns the last task attempt diagnostic for a given failed taskId

@param mrJobId   MR Job Id
@param mrTaskId  MRTask Id
@return Diagnostic in a string format
app/com/linkedin/drelephant/exceptions/MRClient.java