How to find subscriptions of a specific client

Examining subscription behaviour as well as existing subscriptions for an individual client can sometimes be necessary to verify its behaviour. Here we will demonstrate 3 methods to gain insights.

Client overview

The easiest way to retrieve a list of all subscriptions HiveMQ has tied to a client is by using the Control Center’s

Client overview. Here you will need to create an up to date dataset by clicking “Reload snapshot”. This will generate a list of all client current client sessions.

By choosing and inspecting the client you are interested in here, you will be presented with a list of all subscriptions belonging to the client at the time of the snapshot.

Only clients with current sessions will be listed. Expired sessions are removed from the broker

Trace recording

HiveMQ’s capability to produce on demand and filtered Trace Recordings comes in handy when it is more helpful to know a client’s subscribing behaviour over a certain time period rather than the list of all its subscriptions at the time a snapshot was taken.

Capturing all SUBSCRIBE/UNSUBSCRIBE events for a specific client straightforward:

  1. Create a new recording and choose a descriptive name for it

  2. Add a filter matching the client(s) of interest

  3. Select SUBSCRIBE and UNSUBSCRIBE

  4. Choose a time window that should be monitored

Once the recording is started, you may stop it at any time in order to obtain the gathered data form of compressed text files.

Log output

Should the Control Center be inaccessible to you, SUBSCRIBE events can be made visible in the logs by changing the log level to TRACE. From this point forward your log output becomes searchable for the ClientID in question, as well as SUBSCRIBE/UNSUBSCRIBE events. Any subscriptions existing prior to changing the log level will be hidden in the logs until they are at some point subscribed/unsubscribed to by the client.

Beware that HiveMQ will log many entries on this log level. You should monitor your log file sizes when setting the log level to TRACE