We want to use the mqtt protocol of Nginx, but want to record the access log of each mqtt message. Can the commercial version of the mqtt module support this?
Hey @chengchengwang! When you say you want to record the access log, do you mean the traditional NGINX access log or is there any MQTT specific info you would want to record in the access log too?
I noticed that the ngx_stream_mqtt_preread_module in the commercial version of Nginx is implemented based on the stream module, and the stream module’s access log only records each TCP request. However, I want to record the access log for every MQTT message.
After some digging, it seems that this is indeed not possible out of the box. You should be able to use NJS (NGINX JavaScript) to create a MQTT parser and create a per message log that way. I would suggest getting a trial for NGINX Plus (now included as part of NGINX One) and reaching out to our sales team for more info!
I get, thanks!
Hey again! A colleague sent this my way and I figured you might be interested GitHub - gallarda/mqtt5 – it’s a PoC for a MQTT parser written in NJS, like I mentioned in my previous post ![]()
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.