From 9152e6fce0100d2a2534673092a397500e792e52 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Wed, 2 Dec 2026 16:12:09 -0500 Subject: [PATCH] Require a unit on lsheap and esheap in SOC Configuration Without forcedType or regex, SOC accepted a unitless heap such as 500. AlignBestGuess stored it as a YAML integer, which rendered -Xms500 (bytes) and restart-looped the service. On the next save, AlignType then tried ParseInt on the corrected 500m and rejected it. forcedType: string makes SOC store the value as a string whatever the stored type, so an existing integer can be corrected. The regex blocks unitless values in the UI. k, m and g are allowed (either case), matching what the bundled JDKs accept for -Xms/-Xmx; the Logstash JVM options parser passes them through unchanged. Heaps too small to start fail in the JVM whatever the unit, so the regex doesn't check size. --- salt/elasticsearch/soc_elasticsearch.yaml | 5 ++++- salt/logstash/soc_logstash.yaml | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/salt/elasticsearch/soc_elasticsearch.yaml b/salt/elasticsearch/soc_elasticsearch.yaml index a885f15bc..ac2c5d9da 100644 --- a/salt/elasticsearch/soc_elasticsearch.yaml +++ b/salt/elasticsearch/soc_elasticsearch.yaml @@ -17,7 +17,10 @@ elasticsearch: global: True advanced: True esheap: - description: Specify the memory heap size in (m)egabytes for Elasticsearch. + description: Heap size to use for Elasticsearch, as a number followed by k (kilobytes), m (megabytes) or g (gigabytes), such as 600m. + forcedType: string + regex: ^[1-9][0-9]*[kKmMgG]$ + regexFailureMessage: Must be a number followed by k, m or g, such as 600m. helpLink: elasticsearch index_clean: description: Determines if indices should be considered for deletion by available disk space in the cluster. Otherwise, data is retained by the configured lifecycle settings. This setting only applies to EVAL, STANDALONE, and HEAVY NODE installations. Other installations use lifecycle settings only. diff --git a/salt/logstash/soc_logstash.yaml b/salt/logstash/soc_logstash.yaml index edb2a0ee6..09c1a3298 100644 --- a/salt/logstash/soc_logstash.yaml +++ b/salt/logstash/soc_logstash.yaml @@ -403,8 +403,11 @@ logstash: custom8: *pipeline_settings custom9: *pipeline_settings settings: - lsheap: - description: Heap size to use for logstash + lsheap: + description: Heap size to use for Logstash, as a number followed by k (kilobytes), m (megabytes) or g (gigabytes), such as 500m. + forcedType: string + regex: ^[1-9][0-9]*[kKmMgG]$ + regexFailureMessage: Must be a number followed by k, m or g, such as 500m. helpLink: logstash global: False config: