Merge branch 'public-single-node' into victorialogs-wip

This commit is contained in:
Aliaksandr Valialkin 2024-06-04 02:29:45 +02:00
commit 99e4d376eb
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
4 changed files with 11 additions and 5 deletions

View file

@ -35,7 +35,6 @@ The following functionality is planned in the future versions of VictoriaLogs:
- Syslog - Syslog
- Journald (systemd) - Journald (systemd)
- Add missing functionality to [LogsQL](https://docs.victoriametrics.com/victorialogs/logsql/): - Add missing functionality to [LogsQL](https://docs.victoriametrics.com/victorialogs/logsql/):
- [Transformation functions](https://docs.victoriametrics.com/victorialogs/logsql/#transformations).
- [Stream context](https://docs.victoriametrics.com/victorialogs/logsql/#stream-context). - [Stream context](https://docs.victoriametrics.com/victorialogs/logsql/#stream-context).
- Live tailing for [LogsQL filters](https://docs.victoriametrics.com/victorialogs/logsql/#filters) aka `tail -f`. - Live tailing for [LogsQL filters](https://docs.victoriametrics.com/victorialogs/logsql/#filters) aka `tail -f`.
- Web UI with the following abilities: - Web UI with the following abilities:

View file

@ -25,6 +25,7 @@ the returned logs by some field (usually [`_time` field](https://docs.victoriame
```logsql ```logsql
_time:5m | sort by (_time) _time:5m | sort by (_time)
```
If the number of returned logs is too big, it may be limited with the [`limit` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#limit-pipe). If the number of returned logs is too big, it may be limited with the [`limit` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#limit-pipe).
For example, the following query returns 10 most recent logs, which were ingested during the last 5 minutes: For example, the following query returns 10 most recent logs, which were ingested during the last 5 minutes:
@ -294,7 +295,7 @@ See also:
## How to parse JSON inside log message? ## How to parse JSON inside log message?
It is better from performance and resource usage PoV to avoid storing JSON inside [log message](https://docs.victoriametrics.com/victorialogs/keyconcepts/#message-field). It is better from performance and resource usage PoV to avoid storing JSON inside [log message](https://docs.victoriametrics.com/victorialogs/keyconcepts/#message-field).
It is recommended storing individual JSON fields and log fields instead according to [VictoriaLogs data model](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model). It is recommended storing individual JSON fields as log fields instead according to [VictoriaLogs data model](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model).
If you have to store JSON inside log message or inside any other [log fields](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model), If you have to store JSON inside log message or inside any other [log fields](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model),
then the stored JSON can be parsed during query time via [`unpack_json` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#unpack_json-pipe). then the stored JSON can be parsed during query time via [`unpack_json` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#unpack_json-pipe).

View file

@ -725,9 +725,12 @@ func parsePipeSort(lex *lexer) (*pipeSort, error) {
ps.byFields = bfs ps.byFields = bfs
} }
if lex.isKeyword("desc") { switch {
case lex.isKeyword("desc"):
lex.nextToken() lex.nextToken()
ps.isDesc = true ps.isDesc = true
case lex.isKeyword("asc"):
lex.nextToken()
} }
for { for {
@ -797,9 +800,12 @@ func parseBySortFields(lex *lexer) ([]*bySortField, error) {
bf := &bySortField{ bf := &bySortField{
name: fieldName, name: fieldName,
} }
if lex.isKeyword("desc") { switch {
case lex.isKeyword("desc"):
lex.nextToken() lex.nextToken()
bf.isDesc = true bf.isDesc = true
case lex.isKeyword("asc"):
lex.nextToken()
} }
bfs = append(bfs, bf) bfs = append(bfs, bf)
switch { switch {

View file

@ -60,7 +60,7 @@ func TestPipeSort(t *testing.T) {
}) })
// Sort by a single field // Sort by a single field
f("sort by (a)", [][]Field{ f("sort by (a asc) asc", [][]Field{
{ {
{"_msg", `abc`}, {"_msg", `abc`},
{"a", `2`}, {"a", `2`},