fix: exported logs are incomplete

Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
huanggze
2020-08-11 15:11:04 +08:00
parent 575513182b
commit 57adb94911

View File

@@ -295,16 +295,15 @@ func (es *Elasticsearch) ExportLogs(sf logging.SearchFilter, w io.Writer) error
for _, hit := range res.AllHits {
data = append(data, hit.Log)
}
if len(data) == 0 {
return nil
}
// limit to retrieve max 100k records
for i := 0; i < 100; i++ {
if i != 0 {
data, id, err = es.scroll(id)
if err != nil {
return err
}
}
if len(data) == 0 {
return nil
}