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:
@@ -28,6 +28,7 @@ import (
|
||||
|
||||
"github.com/elastic/go-elasticsearch/v7"
|
||||
"github.com/elastic/go-elasticsearch/v7/esapi"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/simple/client/es/versions"
|
||||
)
|
||||
@@ -86,9 +87,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
|
||||
|
||||
Reference in New Issue
Block a user