Skip to content

Commit 7542db1

Browse files
authored
Follow up renaming of ML modules (#10723)
Two renamings has happened which lead to the problem: * the Filebeat module apache2 has been renamed to apache * the ID of ML modules has been suffixed with _ecs As it is still a fragile solution, I have opened an issue for the ML team to add the possibility of listing all available modules with additional meta data: elastic/kibana#30934
1 parent 7a515ea commit 7542db1

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

filebeat/fileset/fileset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ func (fs *Fileset) GetMLConfigs() []mlimporter.MLConfig {
472472
var mlConfigs []mlimporter.MLConfig
473473
for _, ml := range fs.manifest.MachineLearning {
474474
mlConfigs = append(mlConfigs, mlimporter.MLConfig{
475-
ID: fmt.Sprintf("filebeat-%s-%s-%s", fs.mcfg.Module, fs.name, ml.Name),
475+
ID: fmt.Sprintf("filebeat-%s-%s-%s_ecs", fs.mcfg.Module, fs.name, ml.Name),
476476
JobPath: filepath.Join(fs.modulePath, fs.name, ml.Job),
477477
DatafeedPath: filepath.Join(fs.modulePath, fs.name, ml.Datafeed),
478478
MinVersion: ml.MinVersion,

filebeat/fileset/modules.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ import (
3636
)
3737

3838
var availableMLModules = map[string]string{
39-
"apache2": "access",
40-
"nginx": "access",
39+
"apache": "access",
40+
"nginx": "access",
4141
}
4242

4343
type ModuleRegistry struct {
@@ -427,6 +427,11 @@ func (reg *ModuleRegistry) SetupML(esClient PipelineLoader, kibanaClient *kibana
427427
}
428428

429429
for module, fileset := range modules {
430+
// XXX workaround to setup modules after changing the module IDs due to ECS migration
431+
// the proper solution would be to query available modules, and setup the required ones
432+
// related issue: https://github.com/elastic/kibana/issues/30934
433+
module = module + "_ecs"
434+
430435
prefix := fmt.Sprintf("filebeat-%s-%s-", module, fileset)
431436
err := mlimporter.SetupModule(kibanaClient, module, prefix)
432437
if err != nil {

filebeat/tests/system/test_ml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ def _run_ml_test(self, modules_flag):
119119
bufsize=0)
120120

121121
# Check result
122-
self.wait_until(lambda: "filebeat-nginx-access-response_code" in
122+
self.wait_until(lambda: "filebeat-nginx_ecs-access-status_code_rate_ecs" in
123123
(df["job_id"] for df in self.es.transport.perform_request(
124124
"GET", ml_anomaly_detectors_url)["jobs"]),
125125
max_timeout=60)
126-
self.wait_until(lambda: "datafeed-filebeat-nginx-access-response_code" in
126+
self.wait_until(lambda: "datafeed-filebeat-nginx_ecs-access-status_code_rate_ecs" in
127127
(df["datafeed_id"] for df in self.es.transport.perform_request("GET", ml_datafeeds_url)["datafeeds"]))
128128

129129
beat.kill()

0 commit comments

Comments
 (0)