Skip to content

docs/extract: clarify extract array examples for path/request_id#980

Open
withlin wants to merge 1 commit intoVictoriaMetrics:masterfrom
withlin:docs/logsql-first-split-element
Open

docs/extract: clarify extract array examples for path/request_id#980
withlin wants to merge 1 commit intoVictoriaMetrics:masterfrom
withlin:docs/logsql-first-split-element

Conversation

@withlin
Copy link
Contributor

@withlin withlin commented Dec 30, 2025

Describe Your Changes

Fixes: #978

Checklist

The following checks are mandatory:

Comment on lines +1881 to +1896
If you only need the part before `?` in `_msg`, you can skip `split` and directly extract both pieces:

```logsql
... | extract '<path>?<request_id>' from _msg | stats by (path) count()
```

If you already used [`split` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#split-pipe) to turn `_msg` into an array, placeholders let you pick specific items:

First item:
```logsql
... | split "?" from _msg as parts | extract '["<path>"' from parts
```
Second item:
```logsql
... | split "?" from _msg as parts | extract '["<_>","<request_id>"' from parts
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece sounds strange and out of context. The example with split on ? is also complicated and adds unnecessary cognitive overhead for anyone want to understand extract pipe without the context from #978.

Better wording might be fine, but I'd prefer not to add a specialized example. Let's see what other contributors think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract first array element after split for grouping

2 participants