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

@@ -28,6 +28,7 @@ import (
"github.com/elastic/go-elasticsearch/v6"
"github.com/elastic/go-elasticsearch/v6/esapi"
jsoniter "github.com/json-iterator/go"
"kubesphere.io/kubesphere/pkg/simple/client/es/versions"
)
@@ -85,9 +86,16 @@ func (e *Elastic) Search(indices string, body []byte, scroll bool) ([]byte, erro
}
func (e *Elastic) Scroll(id string) ([]byte, error) {
body, err := jsoniter.Marshal(map[string]string{
"scroll_id": id,
})
if err != nil {
return nil, err
}
response, err := e.Client.Scroll(
e.Client.Scroll.WithContext(context.Background()),
e.Client.Scroll.WithScrollID(id),
e.Client.Scroll.WithBody(bytes.NewBuffer(body)),
e.Client.Scroll.WithScroll(time.Minute))
if err != nil {
return nil, err