Skip to content

Commit 77a1017

Browse files
Account for CCS '::' index pattern
1 parent ef0f96c commit 77a1017

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

detection_rules/beats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ def parse_beats_from_index(index: Optional[list]) -> List[str]:
288288
"""Parse beats schema types from index."""
289289
indexes = index or []
290290
beat_types = []
291-
# Need to split on : to support cross-cluster search
291+
# Need to split on : or :: to support cross-cluster search
292292
# e.g. mycluster:logs-* -> logs-*
293293
for index in indexes:
294294
if "beat-*" in index:
295-
index_parts = index.split(':', 1)
295+
index_parts = index.replace('::', ':').split(':', 1)
296296
last_part = index_parts[-1]
297297
beat_type = last_part.split("-")[0]
298298
beat_types.append(beat_type)

detection_rules/ecs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def get_custom_index_schema(index_name: str, stack_version: str = None):
187187
"""Load custom schema."""
188188
custom_schemas = get_custom_schemas(stack_version)
189189
index_schema = custom_schemas.get(index_name, {})
190-
ccs_schema = custom_schemas.get(index_name.split(":", 1)[-1], {})
190+
ccs_schema = custom_schemas.get(index_name.replace('::', ':').split(":", 1)[-1], {})
191191
index_schema.update(ccs_schema)
192192
return index_schema
193193

@@ -197,7 +197,7 @@ def get_index_schema(index_name):
197197
"""Load non-ecs schema."""
198198
non_ecs_schema = get_non_ecs_schema()
199199
index_schema = non_ecs_schema.get(index_name, {})
200-
ccs_schema = non_ecs_schema.get(index_name.split(":", 1)[-1], {})
200+
ccs_schema = non_ecs_schema.get(index_name.replace('::', ':').split(":", 1)[-1], {})
201201
index_schema.update(ccs_schema)
202202
return index_schema
203203

0 commit comments

Comments
 (0)