in aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/plugins/EC2Plugin.java [107:143]
public void populateLogReferences() {
String filePath = null;
String programData = System.getenv(WINDOWS_PROGRAM_DATA);
if (StringValidator.isNullOrBlank(programData)) {
for (Path root : fs.getRootDirectories()) {
if (root.toString().equals(LINUX_ROOT)) {
filePath = LINUX_ROOT + LINUX_PATH;
break;
}
}
} else {
filePath = programData + WINDOWS_PATH;
}
if (filePath == null) {
logger.warn("X-Ray could not recognize the file system in use. Expected file system to be Linux or Windows based.");
return;
}
try {
JsonNode logConfigs = JsonUtils.getNodeFromJsonFile(filePath, LOG_CONFIGS);
List<String> logGroups = JsonUtils.getMatchingListFromJsonArrayNode(logConfigs, LOG_GROUP_NAME);
for (String logGroup : logGroups) {
AWSLogReference logReference = new AWSLogReference();
logReference.setLogGroup(logGroup);
logReferences.add(logReference);
}
} catch (IOException e) {
logger.warn("CloudWatch Agent log configuration file not found at " + filePath + ". Install the CloudWatch Agent "
+ "on this instance to record log references in X-Ray.");
} catch (RuntimeException e) {
logger.warn("An unexpected exception occurred while reading CloudWatch agent log configuration file at " + filePath
+ ":\n", e);
}
}