Skip to content

Commit bf72575

Browse files
committed
add function annotation and bake the default index into the get_all_indexes function
1 parent 6052ef0 commit bf72575

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

contentctl/actions/detection_testing/infrastructures/DetectionTestingInfrastructure.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,11 @@ def configure_hec(self):
172172
# Retrieve all available indexes on the splunk instance
173173
all_indexes = self.get_all_indexes()
174174

175-
indexes = f"{self.sync_obj.replay_index}," + ",".join(all_indexes)
176-
177175
res = self.get_conn().inputs.create(
178176
name="DETECTION_TESTING_HEC",
179177
kind="http",
180178
index=self.sync_obj.replay_index,
181-
indexes=indexes, # This allows the HEC to write to all indexes
179+
indexes=",".join(all_indexes), # This allows the HEC to write to all indexes
182180
useACK=True,
183181
)
184182
self.hec_token = str(res.token)
@@ -187,12 +185,13 @@ def configure_hec(self):
187185
except Exception as e:
188186
raise (Exception(f"Failure creating HEC Endpoint: {str(e)}"))
189187

190-
def get_all_indexes(self):
188+
def get_all_indexes(self) -> list[str]:
191189
"""
192190
Retrieve a list of all indexes in the Splunk instance
193191
"""
194192
try:
195-
indexes = []
193+
# Always include the special, default replay index here
194+
indexes = [self.sync_obj.replay_index]
196195
res = self.get_conn().indexes
197196
for index in res.list():
198197
indexes.append(index.name)

0 commit comments

Comments
 (0)