Skip to content

fix(CSPL-4617): preserve custom httpinput configs set via splunk.conf#904

Open
vivekr-splunk wants to merge 2 commits into
developfrom
CSPL-4617
Open

fix(CSPL-4617): preserve custom httpinput configs set via splunk.conf#904
vivekr-splunk wants to merge 2 commits into
developfrom
CSPL-4617

Conversation

@vivekr-splunk
Copy link
Copy Markdown

Summary

  • Bug 1 — HEC REST overwrites splunk.conf values: The Setup global HEC task in set_as_hec_receiver.yml ran unconditionally and always POSTed to /services/data/inputs/http/http, silently overwriting enableSSL and other global HEC settings (e.g. httpEventCollectorWithAckEnabled) even when the caller only set HEC config via splunk.conf. Fixed by guarding the REST call behind a set_fact that only fires when splunk.hec.* or deprecated hec_* vars are explicitly supplied. enableSSL is now only included in the body when splunk.hec.ssl is explicitly set.

  • Bug 2 — Stale conf file keys persist across pod restarts: When a config map is updated and pods are rolled, keys removed from the config map were not removed from the on-disk .conf file because ini_file with state: present only adds/updates — it never deletes stanzas or keys. This caused old remotequeue (and other) stanza values to persist. Fixed by deleting the target conf file before writing, so each pod start applies a clean state matching the current config map exactly.

Files changed

  • roles/splunk_common/tasks/set_as_hec_receiver.yml — conditional set_fact for HEC body; REST POST guarded by when: hec_global_body is defined
  • roles/splunk_common/tasks/set_config_file.yml — delete conf file before writing stanzas to ensure config map is the source of truth

Test plan

  • Deploy ingestor with splunk.conf setting enableSSL: "0" and httpEventCollectorWithAckEnabled: "true" in splunk_httpinput/local/inputs.conf — verify values survive ansible run (Setup global HEC task should be skipped)
  • Deploy with splunk.hec.ssl: true — verify enableSSL is correctly sent to REST endpoint
  • Update config map to remove a stanza, roll pods — verify removed stanza is gone from the .conf file on disk
  • Deploy with splunk.hec.enable: true + splunk.conf httpinput settings — verify both coexist correctly

Fixes: CSPL-4617

🤖 Generated with Claude Code

vivekr-splunk and others added 2 commits May 7, 2026 21:20
…httpinput

The 'Setup global HEC' task ran unconditionally and always POSTed to
/services/data/inputs/http/http, overwriting enableSSL (and any other
global HEC settings) even when the caller only set HEC config via
splunk.conf. That config map path writes inputs.conf on disk before Splunk
starts, but the REST call after startup would silently reset enableSSL to 0
and ignore httpEventCollectorWithAckEnabled entirely.

Fix: introduce a 'Build global HEC body' set_fact that only fires when at
least one of splunk.hec.{enable,ssl,port,cert} or the deprecated hec_*
variables is explicitly supplied. Guard the REST POST behind
`when: hec_global_body is defined`. When only splunk.conf is used, neither
task runs and the on-disk inputs.conf values are preserved.

enableSSL is now only included in the request body when splunk.hec.ssl is
explicitly set, preventing the implicit default of 0 from overriding a
value written via splunk.conf.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
When a config map is updated and pods are rolled, keys removed from the
config map were not removed from the on-disk .conf file because ini_file
with state=present only adds/updates — it never deletes stanzas or keys.
This caused old remotequeue (and other) stanza values to persist across pod
restarts even after the config map was changed.

Fix: add a task in set_config_file.yml that deletes the target conf file
before writing, so each pod start applies a clean state that exactly
matches the current config map. The removal is guarded by
`conf_stanzas | length > 0` to avoid removing files written by other
tasks when the config map entry has no content stanzas.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vivekr-splunk vivekr-splunk requested a review from a team as a code owner May 7, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants