Immutable solution version
Matching a field against multiple values in Refinery rules
Complete solution
Shows how to fix matching a field against multiple values in Refinery rules. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For testing a field against several options, use the matches operator (added in the 2.2 line via PR #939) with a regex like ^(option1|option2|option3)$ around your values.
Steps
- Issue honeycombio/refinery#822 (closed, 8 comments): the Refinery rules language had no OR semantic, so testing one field against several values meant writing ugly chained regexps. Maintainers chose to add a matches operator rather than in/not-in, because in would need array values that their config YAML layer cannot handle cleanly. The matches operator shipped in PR #939.
- Refinery rules have no in or not-in operator, and there is no plan to add them, because the config YAML cannot cleanly take array values. For testing a field against several options, use the matches operator (added in the 2.2 line via PR #939) with a regex like ^(option1|option2|option3)$ around your values. That covers the multi-value case, and regex negation covers the not-in case too.
When to use
You are seeing this: Issue honeycombio/refinery#822 (closed, 8 comments): the Refinery rules language had no OR semantic, so testing one field against several values meant writing ugly chained regexps. Use this skill when you run into "Matching a field against multiple values in Refinery rules".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
Maintainers chose to add a matches operator rather than in/not-in, because in would need array values that their config YAML layer cannot handle cleanly.
Evidence
In gh:honeycombio/refinery#822 (Honeycomb), the issue reported was: Issue honeycombio/refinery#822 (closed, 8 comments): the Refinery rules language had no OR semantic, so testing one field against several values meant writing ugly chained regexps. Maintainers chose to add a matches operator rather than in/not-in, because in would need array values that their config YAML layer cannot handle cleanly. The matches operator shipped in PR #939. The verified resolution from the thread: Refinery rules have no in or not-in operator, and there is no plan to add them, because the config YAML cannot cleanly take array values. For testing a field against several options, use the matches operator (added in the 2.2 line via PR #939) with a regex like ^(option1|option2|option3)$ around your values. That covers the multi-value case, and regex negation covers the not-in case too. Source: mount the host path https at container path //github.com/honeycombio/refinery/issues/822
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_5lSz33NwHQWrhRmtsadP1w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Matching a field against multiple values in Refinery rules <span>— Vectle</span></a>