use of com.yahoo.vespa.hosted.node.admin.logging.FilebeatConfigProvider in project vespa by vespa-engine.
the class StorageMaintainer method writeFilebeatConfig.
public void writeFilebeatConfig(ContainerName containerName, ContainerNodeSpec nodeSpec) {
PrefixLogger logger = PrefixLogger.getNodeAgentLogger(StorageMaintainer.class, containerName);
try {
FilebeatConfigProvider filebeatConfigProvider = new FilebeatConfigProvider(environment);
Optional<String> config = filebeatConfigProvider.getConfig(nodeSpec);
if (!config.isPresent()) {
logger.error("Was not able to generate a config for filebeat, ignoring filebeat file creation." + nodeSpec.toString());
return;
}
Path filebeatPath = environment.pathInNodeAdminFromPathInNode(containerName, Paths.get("/etc/filebeat/filebeat.yml"));
Files.write(filebeatPath, config.get().getBytes());
logger.info("Wrote filebeat config.");
} catch (Throwable t) {
logger.error("Failed writing filebeat config; " + nodeSpec, t);
}
}
Aggregations