public void logTailOfPostgresLog() { try { File file = Os.newTempFile("postgresql-" + getEntity().getId(), "log"); int result = getMachine().copyFrom(getLogFile(), file.getAbsolutePath()); if (result != 0) throw new IllegalStateException("Could not access log file " + getLogFile()); log.info("Saving {} contents as {}", getLogFile(), file); Streams.logStreamTail( log, "postgresql.log", Streams.byteArrayOfString(Files.toString(file, Charsets.UTF_8)), 1024); file.delete(); } catch (IOException ioe) { log.debug("Error reading copied log file: {}", ioe); } }