java.lang.Object
org.elasticsearch.health.HealthPeriodicLogger
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ClusterStateListener
,SchedulerEngine.Listener
public class HealthPeriodicLogger
extends Object
implements ClusterStateListener, Closeable, SchedulerEngine.Listener
This class periodically logs the results of the Health API to the standard Elasticsearch server log file.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
Called when cluster state changes.static HealthPeriodicLogger
create
(Settings settings, ClusterService clusterService, Client client, HealthService healthService) Creates a new HealthPeriodicLogger.void
triggered
(SchedulerEngine.Event event)
-
Field Details
-
HEALTH_FIELD_PREFIX
- See Also:
-
MESSAGE_FIELD
- See Also:
-
POLL_INTERVAL_SETTING
-
ENABLED_SETTING
-
HEALTH_PERIODIC_LOGGER_JOB_NAME
Name constant for the job HealthService schedules- See Also:
-
-
Method Details
-
create
public static HealthPeriodicLogger create(Settings settings, ClusterService clusterService, Client client, HealthService healthService) Creates a new HealthPeriodicLogger. This creates a scheduled job using the SchedulerEngine framework and runs it on the current health node.- Parameters:
settings
- the cluster settings, used to get the interval setting.clusterService
- the cluster service, used to know when the health node changes.client
- the client used to call the Health Service.healthService
- the Health Service, where the actual Health API logic lives.
-
clusterChanged
Description copied from interface:ClusterStateListener
Called when cluster state changes.Cluster states are applied one-by-one which means they can be a performance bottleneck. Implementations of this method should therefore be fast, so please consider forking work into the background rather than doing everything inline.
- Specified by:
clusterChanged
in interfaceClusterStateListener
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
triggered
- Specified by:
triggered
in interfaceSchedulerEngine.Listener
-