elastic-cloud-enterprise.sh set-logging-and-metrics-policyedit


bash elastic-cloud-enterprise.sh set-logging-and-metrics-policy — Set the retention period for logging and metrics indices


bash elastic-cloud-enterprise.sh set-logging-and-metrics-policy
[--host-docker-host "PATH_NAME/docker.sock"] [--print] [--pattern PATTERN]
[--days DAYS] [--secrets PATH_TO_SECRETS_FILE]
[--host-storage-path PATH_NAME]


To run this script, a user must be part of the docker group. The host that you run this script on must be the first host that you installed Elastic Cloud Enterprise on or a host that holds the director role.


Set the retention period for the logging and metrics indices that allow you to monitor your Elastic Cloud Enterprise installation.


--host-docker-host /PATH_NAME/docker.sock
Specifies the location of the Docker socket used to communicate with the Docker daemon. Defaults to /var/run/docker.sock.
Prints the policy that is currently in effect. Cannot be specified together with --pattern and --days.
--pattern PATTERN
Specifies the index pattern for which a new retention period will be set, such as cluster-logs-*. If specified, --days must also be specified.
--days DAYS
Specifies the number of days that indices matching the given pattern are kept. Defaults to one day for patterns that match metrics indices and seven days for patterns that match logging indices. Specifying 0 or -1 disables index curation and results in indices being retained indefinitely. If specified, --pattern must also be specified.
Specifies a path to a file with secrets. If not specified, attempts to use HOST_STORAGE_PATH/bootstrap-state/bootstrap-secrets.json, where HOST_STORAGE_PATH is the host storage path used by the Elastic Cloud Enterprise installation.
--host-storage-path PATH_NAME
Specifies the host storage path used by the Elastic Cloud Enterprise installation. Defaults to /mnt/data/elastic. Used for determining the default locations of the secrets file and log files.
WARNING: This path cannot be the exact XFS volume mount point, it must be the subdirectory of it. By default, the XFS volume should be mounted at /mnt/data.


Set the retention period for the cluster-logs-* index pattern to 14 days:

bash elastic-cloud-enterprise.sh set-logging-and-metrics-policy --pattern cluster-logs-* --days 14