buildKibanaServerUrl

 private String buildKibanaServerUrl(DiscountIndexMailData mailData,Statistic stat,String failureCause) {
    StringBuilder sb = new StringBuilder(kibanaServerUrl);
    sb.append("#/discover?_g=(time:(from:now-7d,mode:quick,to:now))")
    .append("&_a=(query:(language:lucene,query:'msg:")
    .append(failureCause)
    .append("%20AND%20severity:error%20AND%20class:")
    .append(stat.getTopic())
    .append("%20AND%20timestamp.keyword:%7B%22")
    .append(getLocalTimeStr(getDefaultLocalTimeFromInstant(mailData.getStartTime())))
    .append("%22%20TO%20%22")
    .append(getLocalTimeStr(getDefaultLocalTimeFromInstant(mailData.getEndTime())))
    .append("%22%5D'))");
    return sb.toString();
  }
 public static LocalDateTime getDefaultLocalTimeFromInstant(Instant instant) {
    return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
  }


  public static String getLocalTimeStr(LocalDateTime localDateTime) {
    return localDateTime.toLocalDate().toString() + ' ' + localDateTime.toLocalTime().toString();
  }

kibana.server.url=http://localhost:5601/app/kibana

原文地址:https://www.cnblogs.com/tonggc1668/p/9151594.html