# NGINX MQTT -- Can the MQTT function in the commercial version of NGINX support access log at the MQTT message level?

**URL:** <https://community.nginx.org/t/nginx-mqtt-can-the-mqtt-function-in-the-commercial-version-of-nginx-support-access-log-at-the-mqtt-message-level/5530>\
**Category:** NGINX Commercial Products\
**Tags:** nginx-plus, mqtt\
**Created:** [July 25, 2025, 9:52am UTC](https://community.nginx.org/t/nginx-mqtt-can-the-mqtt-function-in-the-commercial-version-of-nginx-support-access-log-at-the-mqtt-message-level/5530 "2025-07-25T09:52:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chengchengwang](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/chengchengwang/32/2538_2.png) [@chengchengwang](https://community.nginx.org/u/chengchengwang)\
**Post date:** [July 25, 2025, 9:52am UTC](https://community.nginx.org/t/nginx-mqtt-can-the-mqtt-function-in-the-commercial-version-of-nginx-support-access-log-at-the-mqtt-message-level/5530/1 "2025-07-25T09:52:58Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![alessandro](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/alessandro/32/4836_2.png) [@alessandro](https://community.nginx.org/u/alessandro)\
**Post date:** [July 25, 2025, 10:46am UTC](https://community.nginx.org/t/nginx-mqtt-can-the-mqtt-function-in-the-commercial-version-of-nginx-support-access-log-at-the-mqtt-message-level/5530/2 "2025-07-25T10:46:30Z")

</div>

Hey @chengchengwang! When you say you want to record the access log, do you mean the traditional [NGINX access log](https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log) or is there any MQTT specific info you would want to record in the access log too?

---

<div class="post-metadata">

**Author:** ![chengchengwang](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/chengchengwang/32/2538_2.png) [@chengchengwang](https://community.nginx.org/u/chengchengwang)\
**Post date:** [July 28, 2025, 1:29am UTC](https://community.nginx.org/t/nginx-mqtt-can-the-mqtt-function-in-the-commercial-version-of-nginx-support-access-log-at-the-mqtt-message-level/5530/3 "2025-07-28T01:29:59Z")

</div>

I noticed that the [ngx\_stream\_mqtt\_preread\_module](https://nginx.org/en/docs/stream/ngx_stream_mqtt_preread_module.html) 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.

---

<div class="post-metadata">

**Author:** ![alessandro](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/alessandro/32/4836_2.png) [@alessandro](https://community.nginx.org/u/alessandro)\
**Post date:** [July 28, 2025, 6:51pm UTC](https://community.nginx.org/t/nginx-mqtt-can-the-mqtt-function-in-the-commercial-version-of-nginx-support-access-log-at-the-mqtt-message-level/5530/4 "2025-07-28T18:51:09Z")

</div>

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](https://www.f5.com/trials/nginx-one) (now included as part of NGINX One) and reaching out to our sales team for more info!

---

<div class="post-metadata">

**Author:** ![chengchengwang](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/chengchengwang/32/2538_2.png) [@chengchengwang](https://community.nginx.org/u/chengchengwang)\
**Post date:** [July 29, 2025, 1:57am UTC](https://community.nginx.org/t/nginx-mqtt-can-the-mqtt-function-in-the-commercial-version-of-nginx-support-access-log-at-the-mqtt-message-level/5530/5 "2025-07-29T01:57:03Z")

</div>

I get, thanks!

---

<div class="post-metadata">

**Author:** ![alessandro](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/alessandro/32/4836_2.png) [@alessandro](https://community.nginx.org/u/alessandro)\
**Post date:** [July 29, 2025, 8:59am UTC](https://community.nginx.org/t/nginx-mqtt-can-the-mqtt-function-in-the-commercial-version-of-nginx-support-access-log-at-the-mqtt-message-level/5530/6 "2025-07-29T08:59:04Z")

</div>

Hey again! A colleague sent this my way and I figured you might be interested [GitHub - gallarda/mqtt5](https://github.com/gallarda/mqtt5) – it’s a PoC for a MQTT parser written in NJS, like I mentioned in my previous post 🙂

---

<div class="post-metadata">

**Author:** ![system](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/system/32/19_2.png) [@system](https://community.nginx.org/u/system)\
**Post date:** [August 5, 2025, 8:59am UTC](https://community.nginx.org/t/nginx-mqtt-can-the-mqtt-function-in-the-commercial-version-of-nginx-support-access-log-at-the-mqtt-message-level/5530/7 "2025-08-05T08:59:27Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
