Support configuring the maximum number of logs that can be exported (#5794)

* Support configuring the maximum number of logs that can be exported



* Update pkg/simple/client/logging/options.go



---------

Signed-off-by: wanjunlei <wanjunlei@kubesphere.io>
Co-authored-by: wanjunlei <53003665+wanjunlei@users.noreply.github.com>
Co-authored-by: Benjamin Huo <huobj@qq.com>
This commit is contained in:
hongming
2023-06-28 16:24:47 +08:00
committed by GitHub
parent 4b722c12f2
commit d85ebcef1f
7 changed files with 80 additions and 25 deletions

View File

@@ -26,6 +26,7 @@ import (
"net/http"
"time"
jsoniter "github.com/json-iterator/go"
"github.com/opensearch-project/opensearch-go/v2"
"github.com/opensearch-project/opensearch-go/v2/opensearchapi"
@@ -86,9 +87,16 @@ func (o *OpenSearch) Search(indices string, body []byte, scroll bool) ([]byte, e
}
func (o *OpenSearch) Scroll(id string) ([]byte, error) {
body, err := jsoniter.Marshal(map[string]string{
"scroll_id": id,
})
if err != nil {
return nil, err
}
response, err := o.client.Scroll(
o.client.Scroll.WithContext(context.Background()),
o.client.Scroll.WithScrollID(id),
o.client.Scroll.WithBody(bytes.NewBuffer(body)),
o.client.Scroll.WithScroll(time.Minute))
if err != nil {
return nil, err