Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable the option of running setup --machine-learning on its own #20241

Merged
merged 2 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ field. You can revert this change by configuring tags for the module and omittin
- Adds Gsuite Drive support. {pull}19704[19704]
- Adds Gsuite Groups support. {pull}19725[19725]
- Move file metrics to dataset endpoint {pull}19977[19977]
- Disable the option of running --machine-learning on its own. {pull}20241[20241]

*Heartbeat*

Expand Down
2 changes: 1 addition & 1 deletion filebeat/tests/system/test_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _run_ml_test(self, modules_flag):

# Skipping dashboard loading to speed up tests
cmd += ["-E", "setup.dashboards.enabled=false"]
cmd += ["setup", "--machine-learning"]
cmd += ["setup", "--machine-learning", "--dashboards"]
if modules_flag:
cmd += ["--modules=nginx"]

Expand Down
7 changes: 7 additions & 0 deletions libbeat/cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ func genSetupCmd(settings instance.Settings, beatCreator beat.Creator) *cobra.Co
}
}

// XXX this is a workaround for installing index template patterns
// before enabling ML for modules
if s.MachineLearning && !s.Dashboard {
fmt.Fprintf(os.Stderr, "--dashboards must be specified when choosing --machine-learning\n")
os.Exit(1)
}

if err = beat.Setup(settings, beatCreator, s); err != nil {
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion libbeat/ml-importer/importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func SetupModule(kibanaClient MLSetupper, module, prefix string) error {
prefixPayload := fmt.Sprintf("{\"prefix\": \"%s\"}", prefix)
status, response, err := kibanaClient.Request("POST", setupURL, nil, nil, strings.NewReader(prefixPayload))
if status != 200 {
return errors.Errorf("cannot set up ML with prefix: %s", prefix)
return errors.Errorf("cannot set up ML with prefix: %s, response: %s", prefix, string(response))
}
if err != nil {
return err
Expand Down