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 normalization validating fields in transforms if synthetics is enabled #2011

Merged
4 changes: 2 additions & 2 deletions internal/stack/_static/elasticsearch.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ ingest.geoip.downloader.enabled: false

{{- $version := fact "elasticsearch_version" -}}
{{- $logsdb_enabled := fact "logsdb_enabled" -}}
{{ if (and (eq $logsdb_enabled "true") (not (semverLessThan $version "8.15.0-SNAPSHOT"))) }}
cluster.logsdb.enabled: true
{{ if (not (semverLessThan $version "8.15.0-SNAPSHOT")) }}
cluster.logsdb.enabled: {{ $logsdb_enabled }}
{{- end -}}

{{ if semverLessThan $version "8.0.0" }}
Expand Down
2 changes: 1 addition & 1 deletion internal/stack/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func applyResources(profile *profile.Profile, stackVersion string) error {
"apm_enabled": profile.Config(configAPMEnabled, "false"),
"geoip_dir": profile.Config(configGeoIPDir, "./ingest-geoip"),
"kibana_http2_enabled": profile.Config(configKibanaHTTP2Enabled, "true"),
"logsdb_enabled": profile.Config(configLogsDBEnabled, "false"),
"logsdb_enabled": profile.Config(configLogsDBEnabled, "true"),
"logstash_enabled": profile.Config(configLogstashEnabled, "false"),
"self_monitor_enabled": profile.Config(configSelfMonitorEnabled, "false"),
})
Expand Down
5 changes: 3 additions & 2 deletions internal/testrunner/runners/system/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ func (r *tester) validateTestScenario(ctx context.Context, result *testrunner.Re
}

// Check transforms if present
if err := r.checkTransforms(ctx, config, r.pkgManifest, scenario.kibanaDataStream, scenario.dataStream); err != nil {
if err := r.checkTransforms(ctx, config, r.pkgManifest, scenario.kibanaDataStream, scenario.dataStream, scenario.syntheticEnabled); err != nil {
Copy link
Contributor Author

@mrodm mrodm Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the same value as in the main data stream.
Would that assumption be right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what Fleet does with transform indexes. Could we add a test case that would fail without this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check to run a test package for that use case (with logsdb enabled).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new test package ti_anomali_logsdb copied from ti_anomali. This allows to test the package with both logsdb enabled and disabled.

results, _ := result.WithError(err)
return results, nil
}
Expand Down Expand Up @@ -1793,7 +1793,7 @@ func selectPolicyTemplateByName(policies []packages.PolicyTemplate, name string)
return packages.PolicyTemplate{}, fmt.Errorf("policy template %q not found", name)
}

func (r *tester) checkTransforms(ctx context.Context, config *testConfig, pkgManifest *packages.PackageManifest, ds kibana.PackageDataStream, dataStream string) error {
func (r *tester) checkTransforms(ctx context.Context, config *testConfig, pkgManifest *packages.PackageManifest, ds kibana.PackageDataStream, dataStream string, syntheticEnabled bool) error {
transforms, err := packages.ReadTransformsFromPackageRoot(r.packageRootPath)
if err != nil {
return fmt.Errorf("loading transforms for package failed (root: %s): %w", r.packageRootPath, err)
Expand Down Expand Up @@ -1839,6 +1839,7 @@ func (r *tester) checkTransforms(ctx context.Context, config *testConfig, pkgMan
fields.WithSpecVersion(pkgManifest.SpecVersion),
fields.WithNumericKeywordFields(config.NumericKeywordFields),
fields.WithEnabledImportAllECSSChema(true),
fields.WithDisableNormalization(syntheticEnabled),
)
if err != nil {
return fmt.Errorf("creating fields validator for data stream failed (path: %s): %w", transformRootPath, err)
Expand Down