private void copyTTlogs(FileSystem fs, Path path, WorkflowAction action) throws Exception { List<String> ttLogUrls = getTTlogURL(action.getExternalId()); if (ttLogUrls != null) { int index = 1; for (String ttLogURL : ttLogUrls) { LOG.info("Fetching log for action: {} from url: {}", action.getExternalId(), ttLogURL); InputStream in = getURLinputStream(new URL(ttLogURL)); OutputStream out = fs.create( new Path( path, action.getName() + "_" + action.getType() + "_" + getMappedStatus(action.getStatus()) + "-" + index + ".log")); IOUtils.copyBytes(in, out, 4096, true); LOG.info("Copied log to {}", path); index++; } } }