in src/main/java/co/elastic/support/diagnostics/commands/GenerateDiagnosticManifest.java [29:62]
public void execute(DiagnosticContext context) {
logger.info(Constants.CONSOLE, "Writing [diagnostic_manifest.json].");
String product = "elasticsearch";
if (context.diagnosticInputs.diagType.startsWith("kibana")) {
product = "kibana";
} else if (context.diagnosticInputs.diagType.startsWith("logstash")) {
product = "logstash";
}
try {
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
Map<String, Object> manifest = new HashMap<>();
manifest.put("diagnostic", context.diagVersion);
manifest.put("type", product + "_diagnostic");
manifest.put("product", product);
// Logstash does not lookup a version currently
manifest.put("version", context.version != null ? context.version.getVersion() : "0.0.0");
manifest.put("timestamp", SystemProperties.getUtcDateTimeString());
manifest.put("flags", context.diagnosticInputs.toString());
manifest.put("runner", context.diagnosticInputs.runner);
manifest.put("mode", context.diagnosticInputs.mode);
mapper.writeValue(
new File(context.tempDir + SystemProperties.fileSeparator + "diagnostic_manifest.json"),
manifest);
} catch (Exception e) {
logger.info(Constants.CONSOLE, "Error creating [diagnostic_manifest.json]", e);
}
}