def logByJobName()

in cdslogviewer/app/controllers/LogsController.scala [110:122]


  def logByJobName(name:String) = IsAdmin { uid=> request=>
    val base = config.get[String]("cds.logbase")
    val path = Paths.get(base, "podnames", name+".txt")
    if(!path.toFile.exists()) {
      logger.error(s"Pod name file not found at path: ${path.toString()}")
      NotFound(GenericErrorResponse("not_found","Job name not found").asJson)
    } else {
      val fileSource = scala.io.Source.fromFile(base + "/podnames/" + name + ".txt")
      val fileData = try fileSource.mkString finally fileSource.close()
      val uRLToUse = fileData.replace("/var/log/cds_backend/", "/log/").filterNot(_.isWhitespace)
      Ok(URLLink(uRLToUse).asJson)
    }
  }