diff --git a/app/vlogscli/json_prettifier.go b/app/vlogscli/json_prettifier.go index bbaddf3bc..e4f0edc5a 100644 --- a/app/vlogscli/json_prettifier.go +++ b/app/vlogscli/json_prettifier.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "io" + "sort" "sync" ) @@ -120,6 +121,10 @@ func writeJSONObject(w io.Writer, kvs []kv) error { return nil } + sort.Slice(kvs, func(i, j int) bool { + return kvs[i].key < kvs[j].key + }) + fmt.Fprintf(w, "{\n") if err := writeJSONObjectKeyValue(w, kvs[0]); err != nil { return err diff --git a/docs/VictoriaLogs/CHANGELOG.md b/docs/VictoriaLogs/CHANGELOG.md index aa5bbafdc..e1a8b80df 100644 --- a/docs/VictoriaLogs/CHANGELOG.md +++ b/docs/VictoriaLogs/CHANGELOG.md @@ -18,8 +18,6 @@ according to [these docs](https://docs.victoriametrics.com/victorialogs/quicksta * FEATURE: [vlogscli](https://docs.victoriametrics.com/victorialogs/querying/vlogscli/): preserve `less` output after the exit from scrolling mode. This should help re-using previous query results in subsequent queries. * FEATURE: add [`len` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#len-pipe) for calculating the length for the given [log field](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model) value in bytes. -* BUGFIX: [vlogscli](https://docs.victoriametrics.com/victorialogs/querying/vlogscli/): preserve the original order of fields in the displayed query responses. Previously fields were sorted by name. - ## [v0.33.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.33.0-victorialogs) Released at 2024-10-01