New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite rule on $SYS topics does not rewrite topic in messages #3690
Comments
Hi, @oholsen |
As an external client, when I subscribe for |
Hi, @oholsen The rewrite rule will be applied to PUBLISH messages, but it may be different from what you understand. In your rule, if you send a message to the topic In addition, the rule you defined is problematic. The last part of the rewrite rule should be the grammar of the target expression in the regular expression, not the grammar of the topic filter of MQTT. For example, in your rule, if I send a message to the subject If you change the rule to the following content, when sending a message to
|
Thanks for the feedback! This rule now works - and bridges nicely from metrics/# to the destination. However, the question is how to escape the $ in
|
Hi, @oholsen |
Hi, |
Environment:
What happened and what you expected to happen:
I added the following rewrite rule (with the intention of bridging $SYS topics to a destination.
Subscribing to
metrics/#
topics, I received messages, but I expected to receivemetrics/#
topics. Instead, the messages have the original$SYS
topics as shown usingmosquitto_sub -t 'metrics/#' -v -d
:How to reproduce it (as minimally and precisely as possible):
Add the above line to emqx.conf, load the rewrite module, and subscribe to
metrics/#
with mosquitto_sub, wait for sys topics to be published. (Default broker.sys_* settings).Anything else we need to know?:
The intention is to bridge $SYS topics in a chain of MQTT services, accumulating metrics in metrics/ on the final service in the chain. I guess this is also possible to achieve with the rules engine. However, the above appears to be a bug. Or is there an issue with the rewrite configuration?
The text was updated successfully, but these errors were encountered: