private List<String> exceptionChainStringToListOfExceptions(String s) {
    List<String> chain = new ArrayList<String>();
    Pattern stackTraceCausedByClause = Pattern.compile(".*^(?!Caused by).+\\n(?:.*\\tat.+\\n)+");
    Pattern stackTraceOtherThanCausedByClause = Pattern.compile(".*Caused by.+\\n(?:.*\\n)?(?:.*\\s+at.+\\n)*");

    Matcher matcher = stackTraceCausedByClause.matcher(s);
    while (matcher.find()) {
      chain.add(matcher.group());
    }
    matcher = stackTraceOtherThanCausedByClause.matcher(s);
    while (matcher.find()) {
      chain.add(matcher.group());
    }

    if (chain.isEmpty()) {
      //error logs other than stack traces for ex- logs of azkaban level failure in azkaban job
      chain.add(s);
    }
    return chain;
  }
Converts a exception chain string to a list of string exceptions
@param s Exception chain in a string
@return List of exceptions in given the exception chain
app/com/linkedin/drelephant/exceptions/LoggingEvent.java