Skip to content

Conversation

arturminchukov
Copy link
Contributor

@arturminchukov arturminchukov commented Oct 10, 2025

Related issue: #238
Interpolated:

  1. Field Value Variables:
    • field:$var -> field:in("v1", ..., "vN")
    • field:=$var -> field:in("v1", ..., "vN")
    • Values are quoted and escaped via JSON.stringify()
    • "All" values expand to in(*)
  2. Function Contexts:
    • in($var) and contains_any($var) expand to quoted lists
    • Values maintain proper quoting within function calls
  3. Nequality Operators in stream filters:
    • field:!$var -> !field in("v1", ..., "vN")
    • field:!=$var -> !field in("v1", ..., "vN")
  4. Stream Filters:
    • {tag=$var} -> {tag in(...)}
    • {field!=$var} -> {tag not_in(...)}
  5. Restrictions:
    • Interpolation is NOT allowed in regexp (e.g., field:~$var)
    • Invalid usage will show an error message
image

Added these rules to the tooltip near the query input:

image

@arturminchukov arturminchukov linked an issue Oct 10, 2025 that may be closed by this pull request
@arturminchukov arturminchukov changed the title 238 incorrect interpolation of multi value variable in regex 238 fix interpolation of multi variables Oct 10, 2025
@arturminchukov
Copy link
Contributor Author

/build

Copy link

## 🚀 Build Started

**PR:** #412
**Source:** Branch (`238-incorrect-interpolation-of-multi-value-variable-in-regex`)
**Triggered by:** @arturminchukov

[⏳ View build progress](https://github.com/VictoriaMetrics/victorialogs-datasource/actions/runs/18399540815)

Copy link

✅ Preview Build Completed!

Version: v0.21.0-pr412-20251010-073021-5133371
PR: #412
Source: Branch (238-incorrect-interpolation-of-multi-value-variable-in-regex)
Commit: 5133371c79909f9d01b2cf26e29c45f1c0d81fb1
Triggered by: @arturminchukov

📦 Build Artifacts

  • 📦 victoriametrics-logs-datasource-heads-238-incorrect-interpolation-of-multi-value-variable-in-regex-0-g5133371.tar.gz (66.45 MB) 🔐 Signed ✓ SHA1

  • 📦 victoriametrics-logs-datasource-heads-238-incorrect-interpolation-of-multi-value-variable-in-regex-0-g5133371.zip (66.44 MB) 🔐 Signed ✓ SHA1

    📥 Download

    ⬇️ Download from Actions Run

    Artifact name: victoriametrics-logs-datasource-pr412-20251010-073021

    🔐 Attestation

    Build provenance attestation: View details

    🧪 How to test this build
    1. Download the artifact from the Actions run link above
    2. Unzip the downloaded file
    3. Copy the plugin to your Grafana plugins directory:
      # Local Grafana
      unzip victoriametrics-logs-datasource-*.zip
      cp -r victoriametrics-logs-datasource /var/lib/grafana/plugins/
      
      # Docker Grafana
      docker cp victoriametrics-logs-datasource grafana:/var/lib/grafana/plugins/
    4. Restart Grafana:
      # Systemd
      sudo systemctl restart grafana-server
      
      # Docker
      docker restart grafana
    5. Verify the plugin in Grafana: ConfigurationPlugins
    📋 Build Details
    • Workflow: PR Build on Command
    • Branch: 238-incorrect-interpolation-of-multi-value-variable-in-regex
    • Is Fork: ❌ No
    • Retention: 14 days

    ⚠️ Note: This is a preview build for testing only. Artifacts will be automatically deleted after 14 days.

Copy link
Contributor

@Loori-R Loori-R left a comment

Choose a reason for hiding this comment

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

LGTM! Left a couple of minor style suggestions.
Also, I might have missed it, but please double-check that quotes are properly escaped - for example, the value ["10.71.31.18"] should be inserted as "[\"10.71.31.18\"]".

@arturminchukov arturminchukov self-assigned this Oct 13, 2025
Copy link
Contributor

@dmitryk-dk dmitryk-dk left a comment

Choose a reason for hiding this comment

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

Overall looks good! Remove console please

Copy link
Contributor

@dmitryk-dk dmitryk-dk left a comment

Choose a reason for hiding this comment

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

LGTM!


* BUGFIX: fix an issue with parsings of the logs lines when in the logs line empty `_stream` and missed `_msg` fields. See [#330](https://github.com/VictoriaMetrics/victorialogs-datasource/issues/330)
* BUGFIX: fix an issue with parsings of the logs lines when in the logs line empty `_stream` and missed `_msg` fields. See [#330](https://github.com/VictoriaMetrics/victorialogs-datasource/issues/330).
* BUGFIX: fix interpolation of multi-value query variables by mapping `filerName:$filterVar` and `filerName:$filterVar` to the `filerName:in("v1", ..., "vN")`, also supports negative operators and stream tags(`{tag = $var}` to `{tag in($var)}`). Disallow interpolation in regexp with variables (e.g., `field:~$var`). See [#238](https://github.com/VictoriaMetrics/victorialogs-datasource/issues/238).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* BUGFIX: fix interpolation of multi-value query variables by mapping `filerName:$filterVar` and `filerName:$filterVar` to the `filerName:in("v1", ..., "vN")`, also supports negative operators and stream tags(`{tag = $var}` to `{tag in($var)}`). Disallow interpolation in regexp with variables (e.g., `field:~$var`). See [#238](https://github.com/VictoriaMetrics/victorialogs-datasource/issues/238).
* BUGFIX: fix interpolation of multi-value query variables by mapping `filterName:$filterVar` and `filterName:=$filterVar` to the `filerName:in("v1", ..., "vN")`. Support negative operators and stream tags(`{tag = $var}` to `{tag in($var)}`). Disallow interpolation in regexp with variables (e.g., `field:~$var`). See [#238](https://github.com/VictoriaMetrics/victorialogs-datasource/issues/238).

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.

incorrect interpolation of multi-value variable in regex

4 participants