From dca10f11d2974a83ec876e0fa5ca71074c8af109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phanie=20Jaumotte?= Date: Wed, 31 Jul 2024 08:10:10 +0200 Subject: [PATCH] group unused parameters (logging) --- REFERENCE.md | 54 +++++++++++++------ data/common.yaml | 14 ----- manifests/config.pp | 6 +-- manifests/init.pp | 53 +++++++++--------- .../etc/elasticsearch/log4j2.properties.erb | 2 +- 5 files changed, 68 insertions(+), 61 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 3ec71e538..033928176 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -297,7 +297,9 @@ copying files from the `configdir` to instance `configdir`s. Data type: `String` -File pattern for the file appender log when file_rolling_type is 'dailyRollingFile'. +UNUSED, File pattern for the file appender log when file_rolling_type is 'dailyRollingFile'. + +Default value: `"'.'yyyy-MM-dd"` ##### `datadir` @@ -309,9 +311,9 @@ Allows you to set the data directory of Elasticsearch. Data type: `String` -Default logging level for Elasticsearch. +UNUSED, Default logging level for Elasticsearch. -Default value: `$logging_level` +Default value: `'INFO'` ##### `defaults_location` @@ -323,14 +325,18 @@ Absolute path to directory containing init defaults file. Data type: `Boolean` -Whether to enable deprecation logging. If enabled, deprecation logs will be +UNUSED, Whether to enable deprecation logging. If enabled, deprecation logs will be saved to ${cluster.name}_deprecation.log in the Elasticsearch log folder. +Default value: `false` + ##### `deprecation_logging_level` Data type: `String` -Default deprecation logging level for Elasticsearch. +UNUSED, Default deprecation logging level for Elasticsearch. + +Default value: `'DEBUG'` ##### `download_tool` @@ -369,10 +375,12 @@ The user Elasticsearch should run as. This also sets file ownership. Data type: `Enum['dailyRollingFile', 'rollingFile', 'file']` -Configuration for the file appender rotation. It can be 'dailyRollingFile', +UNUSED, Configuration for the file appender rotation. It can be 'dailyRollingFile', 'rollingFile' or 'file'. The first rotates by name, the second one by size or third don't rotate automatically. +Default value: `'dailyRollingFile'` + ##### `homedir` Data type: `Stdlib::Absolutepath` @@ -449,28 +457,36 @@ Default value: `'2750'` Data type: `Hash` -Representation of information to be included in the log4j.properties file. +UNUSED, Representation of information to be included in the log4j.properties file. + +Default value: `{}` ##### `logging_file` Data type: `Optional[String]` -Instead of a hash, you may supply a `puppet://` file source for the +UNUSED, Instead of a hash, you may supply a `puppet://` file source for the log4j.properties file. +Default value: `undef` + ##### `logging_level` Data type: `String` -Default logging level for Elasticsearch. +UNUSED, Default logging level for Elasticsearch. + +Default value: `'INFO'` ##### `logging_template` -Data type: `Optional[String]` +Data type: `String` -Use a custom logging template - just supply the relative path, i.e. +UNUSED, Use a custom logging template - just supply the relative path, i.e. `$module/elasticsearch/logging.yml.erb` +Default value: `"${module_name}/etc/elasticsearch/log4j2.properties.erb"` + ##### `manage_datadir` Data type: `Boolean` @@ -662,13 +678,17 @@ Define roles via a hash. This is mainly used with Hiera's auto binding. Data type: `Integer` -Max number of logs to store whern file_rolling_type is 'rollingFile' +UNUSED, Max number of logs to store whern file_rolling_type is 'rollingFile' + +Default value: `1` ##### `rolling_file_max_file_size` Data type: `String` -Max log file size when file_rolling_type is 'rollingFile' +UNUSED, Max log file size when file_rolling_type is 'rollingFile' + +Default value: `'10MB'` ##### `scripts` @@ -687,16 +707,20 @@ Elasticsearch keystore file. If unset, the keystore is left unmanaged. Data type: `Optional[String]` -File content for x-pack logging configuration file (will be placed +UNUSED, File content for x-pack logging configuration file (will be placed into log4j2.properties file). +Default value: `undef` + ##### `security_logging_source` Data type: `Optional[String]` -File source for x-pack logging configuration file (will be placed +UNUSED, File source for x-pack logging configuration file (will be placed into log4j2.properties). +Default value: `undef` + ##### `service_name` Data type: `String` diff --git a/data/common.yaml b/data/common.yaml index 773325fdd..8f9b06c55 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -11,17 +11,11 @@ elasticsearch::autoupgrade: false elasticsearch::config: {} elasticsearch::configdir: "/etc/elasticsearch" elasticsearch::configdir_recurselimit: 2 -elasticsearch::default_logging_level: INFO -elasticsearch::daily_rolling_date_pattern: | - "'.'yyyy-MM-dd" elasticsearch::defaults_location: -elasticsearch::deprecation_logging: false -elasticsearch::deprecation_logging_level: DEBUG elasticsearch::download_tool: elasticsearch::download_tool_insecure: elasticsearch::download_tool_verify_certificates: true elasticsearch::ensure: present -elasticsearch::file_rolling_type: dailyRollingFile elasticsearch::indices: {} elasticsearch::init_defaults: {} elasticsearch::init_defaults_file: @@ -30,10 +24,6 @@ elasticsearch::instances: {} elasticsearch::jvm_options: [] elasticsearch::license: elasticsearch::logdir: "/var/log/elasticsearch" -elasticsearch::logging_config: {} -elasticsearch::logging_file: -elasticsearch::logging_level: INFO -elasticsearch::logging_template: elasticsearch::manage_datadir: true elasticsearch::manage_logdir: true elasticsearch::manage_repo: true @@ -53,12 +43,8 @@ elasticsearch::purge_secrets: false elasticsearch::repo_stage: false elasticsearch::restart_on_change: false elasticsearch::roles: {} -elasticsearch::rolling_file_max_backup_index: 1 -elasticsearch::rolling_file_max_file_size: 10MB elasticsearch::scripts: {} elasticsearch::secrets: -elasticsearch::security_logging_content: -elasticsearch::security_logging_source: elasticsearch::service_name: elasticsearch elasticsearch::service_provider: systemd elasticsearch::snapshot_repositories: {} diff --git a/manifests/config.pp b/manifests/config.pp index 9aeb2cb10..d8cfd7b1e 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -145,11 +145,7 @@ # if ($elasticsearch::logging_file != undef) { # $_log4j_content = undef # } else { - # if ($elasticsearch::logging_template != undef ) { - # $_log4j_content = template($elasticsearch::logging_template) - # } else { - # $_log4j_content = template("${module_name}/etc/elasticsearch/log4j2.properties.erb") - # } + # $_log4j_content = template($elasticsearch::logging_template) # $_logging_source = undef # } # file { diff --git a/manifests/init.pp b/manifests/init.pp index e97ad1217..d2f7af2cc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -77,23 +77,23 @@ # copying files from the `configdir` to instance `configdir`s. # # @param daily_rolling_date_pattern -# File pattern for the file appender log when file_rolling_type is 'dailyRollingFile'. +# UNUSED, File pattern for the file appender log when file_rolling_type is 'dailyRollingFile'. # # @param datadir # Allows you to set the data directory of Elasticsearch. # # @param default_logging_level -# Default logging level for Elasticsearch. +# UNUSED, Default logging level for Elasticsearch. # # @param defaults_location # Absolute path to directory containing init defaults file. # # @param deprecation_logging -# Whether to enable deprecation logging. If enabled, deprecation logs will be +# UNUSED, Whether to enable deprecation logging. If enabled, deprecation logs will be # saved to ${cluster.name}_deprecation.log in the Elasticsearch log folder. # # @param deprecation_logging_level -# Default deprecation logging level for Elasticsearch. +# UNUSED, Default deprecation logging level for Elasticsearch. # # @param download_tool # Command-line invocation with which to retrieve an optional package_url. @@ -114,7 +114,7 @@ # The user Elasticsearch should run as. This also sets file ownership. # # @param file_rolling_type -# Configuration for the file appender rotation. It can be 'dailyRollingFile', +# UNUSED, Configuration for the file appender rotation. It can be 'dailyRollingFile', # 'rollingFile' or 'file'. The first rotates by name, the second one by size # or third don't rotate automatically. # @@ -152,17 +152,17 @@ # Mode directory that will be used for Elasticsearch logging (default 2750). # # @param logging_config -# Representation of information to be included in the log4j.properties file. +# UNUSED, Representation of information to be included in the log4j.properties file. # # @param logging_file -# Instead of a hash, you may supply a `puppet://` file source for the +# UNUSED, Instead of a hash, you may supply a `puppet://` file source for the # log4j.properties file. # # @param logging_level -# Default logging level for Elasticsearch. +# UNUSED, Default logging level for Elasticsearch. # # @param logging_template -# Use a custom logging template - just supply the relative path, i.e. +# UNUSED, Use a custom logging template - just supply the relative path, i.e. # `$module/elasticsearch/logging.yml.erb` # # @param manage_datadir @@ -268,10 +268,10 @@ # Define roles via a hash. This is mainly used with Hiera's auto binding. # # @param rolling_file_max_backup_index -# Max number of logs to store whern file_rolling_type is 'rollingFile' +# UNUSED, Max number of logs to store whern file_rolling_type is 'rollingFile' # # @param rolling_file_max_file_size -# Max log file size when file_rolling_type is 'rollingFile' +# UNUSED, Max log file size when file_rolling_type is 'rollingFile' # # @param scripts # Define scripts via a hash. This is mainly used with Hiera's auto binding. @@ -281,11 +281,11 @@ # Elasticsearch keystore file. If unset, the keystore is left unmanaged. # # @param security_logging_content -# File content for x-pack logging configuration file (will be placed +# UNUSED, File content for x-pack logging configuration file (will be placed # into log4j2.properties file). # # @param security_logging_source -# File source for x-pack logging configuration file (will be placed +# UNUSED, File source for x-pack logging configuration file (will be placed # into log4j2.properties). # # @param service_name @@ -361,17 +361,13 @@ Hash $config, Stdlib::Absolutepath $configdir, Integer $configdir_recurselimit, - String $daily_rolling_date_pattern, Elasticsearch::Multipath $datadir, Optional[Stdlib::Absolutepath] $defaults_location, - Boolean $deprecation_logging, - String $deprecation_logging_level, Optional[String] $download_tool, Optional[String] $download_tool_insecure, Boolean $download_tool_verify_certificates, String $elasticsearch_group, String $elasticsearch_user, - Enum['dailyRollingFile', 'rollingFile', 'file'] $file_rolling_type, Stdlib::Absolutepath $homedir, Hash $indices, Hash $init_defaults, @@ -380,10 +376,6 @@ Array[String] $jvm_options, Optional[Variant[String, Hash]] $license, Stdlib::Absolutepath $logdir, - Hash $logging_config, - Optional[String] $logging_file, - String $logging_level, - Optional[String] $logging_template, Boolean $manage_datadir, Boolean $manage_logdir, Boolean $manage_repo, @@ -404,12 +396,8 @@ Variant[Boolean, String] $repo_stage, Boolean $restart_on_change, Hash $roles, - Integer $rolling_file_max_backup_index, - String $rolling_file_max_file_size, Hash $scripts, Optional[Hash] $secrets, - Optional[String] $security_logging_content, - Optional[String] $security_logging_source, String $service_name, Enum['init', 'openbsd', 'openrc', 'systemd'] $service_provider, Hash $snapshot_repositories, @@ -427,7 +415,6 @@ Hash $slm_policies = {}, Optional[Stdlib::Absolutepath] $ca_certificate = undef, Optional[Stdlib::Absolutepath] $certificate = undef, - String $default_logging_level = $logging_level, Optional[String] $keystore_password = undef, Optional[Stdlib::Absolutepath] $keystore_path = undef, Optional[Stdlib::Absolutepath] $private_key = undef, @@ -436,6 +423,20 @@ Boolean $restart_package_change = $restart_on_change, Boolean $restart_plugin_change = $restart_on_change, Stdlib::Filemode $logdir_mode = '2750', + # Deprecated (not used) + String $daily_rolling_date_pattern = "'.'yyyy-MM-dd", + String $default_logging_level = 'INFO', + Enum['dailyRollingFile', 'rollingFile', 'file'] $file_rolling_type = 'dailyRollingFile', + Hash $logging_config = {}, + Optional[String] $logging_file = undef, + String $logging_level = 'INFO', + String $logging_template = "${module_name}/etc/elasticsearch/log4j2.properties.erb", + Boolean $deprecation_logging = false, + String $deprecation_logging_level = 'DEBUG', + Integer $rolling_file_max_backup_index = 1, + String $rolling_file_max_file_size = '10MB', + Optional[String] $security_logging_content = undef, + Optional[String] $security_logging_source = undef, ) { #### Validate parameters diff --git a/templates/etc/elasticsearch/log4j2.properties.erb b/templates/etc/elasticsearch/log4j2.properties.erb index 89ba143cc..dce798ac0 100644 --- a/templates/etc/elasticsearch/log4j2.properties.erb +++ b/templates/etc/elasticsearch/log4j2.properties.erb @@ -59,7 +59,7 @@ appender.deprecation_rolling.strategy.max = 4 logger.deprecation.name = org.elasticsearch.deprecation <%- if scope['elasticsearch::deprecation_logging'] -%> -logger.deprecation.level = <%= scope['elasitcsearch::deprecation_logging_level'].downcase %> +logger.deprecation.level = <%= scope['elasticsearch::deprecation_logging_level'].downcase %> <%- else -%> logger.deprecation.level = warn <%- end -%>