mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vmui/logs: add log sorting (#7344)
### Describe Your Changes add sorting of logs by groups and within each group by time in desc order. See #7184 and #7045 ### Checklist The following checks are **mandatory**: - [ ] My change adheres [VictoriaMetrics contributing guidelines](https://docs.victoriametrics.com/contributing/). Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
This commit is contained in:
parent
3d75c39ff4
commit
1e1952acf5
2 changed files with 9 additions and 4 deletions
|
@ -64,11 +64,15 @@ const GroupLogs: FC<TableLogsProps> = ({ logs, settingsRef }) => {
|
||||||
return groupByMultipleKeys(logs, [groupBy]).map((item) => {
|
return groupByMultipleKeys(logs, [groupBy]).map((item) => {
|
||||||
const streamValue = item.values[0]?.[groupBy] || "";
|
const streamValue = item.values[0]?.[groupBy] || "";
|
||||||
const pairs = getStreamPairs(streamValue);
|
const pairs = getStreamPairs(streamValue);
|
||||||
|
// values sorting by time
|
||||||
|
const values = item.values.sort((a,b) => new Date(b._time).getTime() - new Date(a._time).getTime());
|
||||||
return {
|
return {
|
||||||
...item,
|
keys: item.keys,
|
||||||
|
keysString: item.keys.join(""),
|
||||||
|
values,
|
||||||
pairs,
|
pairs,
|
||||||
};
|
};
|
||||||
});
|
}).sort((a, b) => a.keysString.localeCompare(b.keysString)); // groups sorting
|
||||||
}, [logs, groupBy]);
|
}, [logs, groupBy]);
|
||||||
|
|
||||||
const handleClickByPair = (value: string) => async (e: MouseEvent<HTMLDivElement>) => {
|
const handleClickByPair = (value: string) => async (e: MouseEvent<HTMLDivElement>) => {
|
||||||
|
@ -117,7 +121,7 @@ const GroupLogs: FC<TableLogsProps> = ({ logs, settingsRef }) => {
|
||||||
{groupData.map((item, i) => (
|
{groupData.map((item, i) => (
|
||||||
<div
|
<div
|
||||||
className="vm-group-logs-section"
|
className="vm-group-logs-section"
|
||||||
key={item.keys.join("")}
|
key={item.keysString}
|
||||||
>
|
>
|
||||||
<Accordion
|
<Accordion
|
||||||
key={String(expandGroups[i])}
|
key={String(expandGroups[i])}
|
||||||
|
@ -129,7 +133,7 @@ const GroupLogs: FC<TableLogsProps> = ({ logs, settingsRef }) => {
|
||||||
{item.pairs.map((pair) => (
|
{item.pairs.map((pair) => (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={copied === pair ? "Copied" : "Copy to clipboard"}
|
title={copied === pair ? "Copied" : "Copy to clipboard"}
|
||||||
key={`${item.keys.join("")}_${pair}`}
|
key={`${item.keysString}_${pair}`}
|
||||||
placement={"top-center"}
|
placement={"top-center"}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -20,6 +20,7 @@ according to [these docs](https://docs.victoriametrics.com/victorialogs/quicksta
|
||||||
* FEATURE: support returning historical logs from [live tailing API](https://docs.victoriametrics.com/victorialogs/querying/#live-tailing) via `start_offset` query arg. For example, request to `/select/logsql/tail?query=*&start_offset=5m` returns logs for the last 5 minutes before starting returning live tailing logs for the given `query`.
|
* FEATURE: support returning historical logs from [live tailing API](https://docs.victoriametrics.com/victorialogs/querying/#live-tailing) via `start_offset` query arg. For example, request to `/select/logsql/tail?query=*&start_offset=5m` returns logs for the last 5 minutes before starting returning live tailing logs for the given `query`.
|
||||||
* FEATURE: add an ability to specify extra fields for logs ingested via [HTTP-based data ingestion protocols](https://docs.victoriametrics.com/victorialogs/data-ingestion/#http-apis). See `extra_fields` query arg and `VL-Extra-Fields` HTTP header in [these docs](https://docs.victoriametrics.com/victorialogs/data-ingestion/#http-parameters).
|
* FEATURE: add an ability to specify extra fields for logs ingested via [HTTP-based data ingestion protocols](https://docs.victoriametrics.com/victorialogs/data-ingestion/#http-apis). See `extra_fields` query arg and `VL-Extra-Fields` HTTP header in [these docs](https://docs.victoriametrics.com/victorialogs/data-ingestion/#http-parameters).
|
||||||
* FEATURE: add [`block_stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#block_stats-pipe) for returning various per-block stats. This pipe is useful for debugging.
|
* FEATURE: add [`block_stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#block_stats-pipe) for returning various per-block stats. This pipe is useful for debugging.
|
||||||
|
* FEATURE: [web UI](https://docs.victoriametrics.com/victorialogs/querying/#web-ui): add sorting of logs by groups and within each group by time in desc order. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7184) and [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7045).
|
||||||
|
|
||||||
* BUGFIX: properly sort fields with floating-point numbers by [`sort` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#sort-pipe). Previously floating-point numbers could be improperly sorted because they were treated as strings, and [natural sorting](https://en.wikipedia.org/wiki/Natural_sort_order) was incorrectly applied to them. For example, `0.123` was treated as bigger than `0.9`.
|
* BUGFIX: properly sort fields with floating-point numbers by [`sort` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#sort-pipe). Previously floating-point numbers could be improperly sorted because they were treated as strings, and [natural sorting](https://en.wikipedia.org/wiki/Natural_sort_order) was incorrectly applied to them. For example, `0.123` was treated as bigger than `0.9`.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue