use of org.graylog2.storage.versionprobe.ElasticsearchProbeException in project graylog2-server by Graylog2.
the class CmdLineTool method annotateInjectorExceptions.
protected void annotateInjectorExceptions(Collection<Message> messages) {
for (Message message : messages) {
// noinspection ThrowableResultOfMethodCallIgnored
final Throwable rootCause = ExceptionUtils.getRootCause(message.getCause());
if (rootCause instanceof NodeIdPersistenceException) {
LOG.error(UI.wallString("Unable to read or persist your NodeId file. This means your node id file (" + configuration.getNodeIdFile() + ") is not readable or writable by the current user. The following exception might give more information: " + message));
System.exit(-1);
} else if (rootCause instanceof AccessDeniedException) {
LOG.error(UI.wallString("Unable to access file " + rootCause.getMessage()));
System.exit(-2);
} else if (rootCause instanceof UnsupportedSearchException) {
final SearchVersion search = ((UnsupportedSearchException) rootCause).getSearchMajorVersion();
LOG.error(UI.wallString("Unsupported search version: " + search, DocsHelper.PAGE_ES_VERSIONS.toString()));
System.exit(-3);
} else if (rootCause instanceof ElasticsearchProbeException) {
LOG.error(UI.wallString(rootCause.getMessage(), DocsHelper.PAGE_ES_CONFIGURATION.toString()));
System.exit(-4);
} else {
// other guice error, still print the raw messages
// TODO this could potentially print duplicate messages depending on what a subclass does...
LOG.error("Guice error (more detail on log level debug): {}", message.getMessage());
if (rootCause != null) {
LOG.debug("Stacktrace:", rootCause);
}
}
}
}
use of org.graylog2.storage.versionprobe.ElasticsearchProbeException in project graylog2-server by Graylog2.
the class SearchDbPreflightCheck method runCheck.
@Override
public void runCheck() throws PreflightCheckException {
try {
final SearchVersion searchVersion = elasticVersionProbe.probe(elasticsearchHosts).orElseThrow(() -> new PreflightCheckException("Could not get Elasticsearch version"));
if (SUPPORTED_ES_VERSIONS.stream().noneMatch(searchVersion::satisfies)) {
throw new PreflightCheckException(StringUtils.f("Unsupported (Elastic/Open)Search version <%s>. Supported versions: <%s>", searchVersion, SUPPORTED_ES_VERSIONS));
}
LOG.info("Connected to (Elastic/Open)Search version <{}>", searchVersion);
} catch (ElasticsearchProbeException e) {
throw new PreflightCheckException(e);
}
}
use of org.graylog2.storage.versionprobe.ElasticsearchProbeException in project graylog2-server by Graylog2.
the class ElasticsearchVersionProvider method get.
@Override
public SearchVersion get() {
if (this.versionOverride.isPresent()) {
final SearchVersion explicitVersion = versionOverride.get();
LOG.info("Elasticsearch version set to " + explicitVersion + " - disabling version probe.");
return explicitVersion;
}
try {
return this.cachedVersion.get(() -> {
final Optional<SearchVersion> probedVersion = this.versionProbe.probe(this.elasticsearchHosts);
probedVersion.ifPresent(version -> LOG.info("Elasticsearch cluster is running " + version));
return probedVersion;
}).orElseThrow(() -> new ElasticsearchProbeException(NO_HOST_REACHABLE_ERROR + "!"));
} catch (ExecutionException | InterruptedException e) {
throw new ElasticsearchProbeException(NO_HOST_REACHABLE_ERROR + ": ", e);
}
}
Aggregations