private void download(AgentData agentData) {
String ip = agentData.getPublicAddress();
String agentAddress = agentData.getAddress().toString();
LOGGER.info(format("Downloading Agent logs from %s", ip));
String outputPath = outputDirectory.getAbsolutePath();
String rsyncCommand = format(RSYNC_COMMAND, "--backup --suffix=-%s ", sshOptions, sshUser, outputPath);
bash.executeQuiet(format(rsyncCommand, ip, ip, "agent.out"));
bash.executeQuiet(format(rsyncCommand, ip, ip, "agent.err"));
File agentOut = new File(outputPath, "agent.out");
File agentErr = new File(outputPath, "agent.err");
rename(agentOut, new File(outputPath, agentAddress + '-' + ip + "-agent.out"));
rename(agentErr, new File(outputPath, agentAddress + '-' + ip + "-agent.err"));
}
}