From bdbb94674df2e57e7e592b745d1f4dcdc32de693 Mon Sep 17 00:00:00 2001 From: Cyril David Date: Tue, 26 Jan 2021 14:41:54 -0800 Subject: [PATCH] Ensure we're displaying in correct sorted order --- internal/cli/logs.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/cli/logs.go b/internal/cli/logs.go index 7dfd02dc8..898d510cd 100644 --- a/internal/cli/logs.go +++ b/internal/cli/logs.go @@ -2,6 +2,7 @@ package cli import ( "fmt" + "sort" "time" "github.com/spf13/cobra" @@ -64,12 +65,13 @@ Show the tenant logs. for { list, err = cli.api.Log.List( - management.Query(fmt.Sprintf("log_id:[* TO %s]", lastLogID)), + management.Query(fmt.Sprintf("log_id:[%s TO *]", lastLogID)), management.Parameter("page", "0"), - management.Parameter("per_page", "1000"), + management.Parameter("per_page", "100"), management.Parameter("sort", "date:-1"), ) if err != nil { + cli.renderer.Errorf("Error: %v", err) return } @@ -110,5 +112,9 @@ func dedupLogs(list []*management.Log, set map[string]struct{}) []*management.Lo } } + sort.Slice(res, func(i, j int) bool { + return res[i].GetDate().Before(res[j].GetDate()) + }) + return res }