diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 66b248ca692..2728c93ebfd 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -183,6 +183,7 @@ https://github.com/elastic/beats/compare/v8.2.0\...main[Check the HEAD diff] - Add beta `take over` mode for `filestream` for simple migration from `log` inputs {pull}34292[34292] - Add pagination support for Salesforce module. {issue}34057[34057] {pull}34065[34065] - Allow users to redact sensitive data from CEL input debug logs. {pull}34302[34302] +- Added support for HTTP destination override to Google Cloud Storage input. {pull}34413[34413] *Auditbeat* diff --git a/x-pack/filebeat/input/gcs/client.go b/x-pack/filebeat/input/gcs/client.go index bb2b9135b5d..128ab753d92 100644 --- a/x-pack/filebeat/input/gcs/client.go +++ b/x-pack/filebeat/input/gcs/client.go @@ -7,6 +7,7 @@ package gcs import ( "context" "errors" + "net/url" "cloud.google.com/go/storage" "google.golang.org/api/option" @@ -15,6 +16,15 @@ import ( ) func fetchStorageClient(ctx context.Context, cfg config, log *logp.Logger) (*storage.Client, error) { + if cfg.AlternativeHost != "" { + var h *url.URL + h, err := url.Parse(cfg.AlternativeHost) + if err != nil { + return nil, err + } + h.Path = "storage/v1/" + return storage.NewClient(ctx, option.WithEndpoint(h.String()), option.WithoutAuthentication()) + } if cfg.Auth.CredentialsJSON != nil { return storage.NewClient(ctx, option.WithCredentialsJSON([]byte(cfg.Auth.CredentialsJSON.AccountKey))) } else if cfg.Auth.CredentialsFile != nil { diff --git a/x-pack/filebeat/input/gcs/config.go b/x-pack/filebeat/input/gcs/config.go index a322ecbdb9e..a22ee5fde8b 100644 --- a/x-pack/filebeat/input/gcs/config.go +++ b/x-pack/filebeat/input/gcs/config.go @@ -27,6 +27,8 @@ type config struct { ParseJSON *bool `config:"parse_json,omitempty"` BucketTimeOut *time.Duration `config:"bucket_timeout,omitempty"` Buckets []bucket `config:"buckets" validate:"required"` + // This field is only used for system test purposes, to override the HTTP endpoint. + AlternativeHost string `config:"alternative_host,omitempty"` } // bucket contains the config for each specific object storage bucket in the root account