Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Tracking down the publisher of a message

But since you are going to need to restart the broker to put it in verbose mode then the client is going to need to reconnect so the connection should be recorded in the logs.

Also if that doesn't work, then wireshark is probably the best option to capture the network traffic and inspect the messages. How practical that is will depend on the message volume. But it could probably be scripted.

On 11/11/2021 10:03, Andrew Holt wrote:
Hi,

I'll give that a try.

The only snag I see is if the client connected some time ago and never disconnected.

Thanks,
Andrew

On Thu, 11 Nov 2021 at 09:54, Ben Hardill <hardillb@xxxxxxxxx <mailto:hardillb@xxxxxxxxx>> wrote:

    IF you start mosquitto in verbose mode it will log the length of the
    message it received.

    e.g. The following show 2 mosquitto_pub clients connect, the first
    published a payload of "ben" shown as 3 bytes, the second published a
    null payload shown as 0 bytes.

    The log line has the client id which can be matched to the earlier log
    entry with the ip address.

    $ mosquitto -p 1888 -v
    1636624290: mosquitto version 2.0.13 starting
    1636624290: Using default config.
    1636624290: Starting in local only mode. Connections will only be
    possible from clients running on this machine.
    1636624290: Create a configuration file which defines a listener to
    allow remote access.
    1636624290: For more details see
    https://mosquitto.org/documentation/authentication-methods/
    <https://mosquitto.org/documentation/authentication-methods/>
    1636624290: Opening ipv4 listen socket on port 1888.
    1636624290: Opening ipv6 listen socket on port 1888.
    1636624290: mosquitto version 2.0.13 running
    1636624309: New connection from 127.0.0.1:60126
    <http://127.0.0.1:60126> on port 1888.
    1636624309: New client connected from 127.0.0.1:60126
    <http://127.0.0.1:60126> as
    auto-66D62DF4-D085-B93E-A3F7-859C745218AD (p2, c1, k60).
    1636624309: No will message specified.
    1636624309: Sending CONNACK to
    auto-66D62DF4-D085-B93E-A3F7-859C745218AD
    (0, 0)
    1636624309: Received PUBLISH from
    auto-66D62DF4-D085-B93E-A3F7-859C745218AD (d0, q0, r0, m0, 'foo',
    ... (3
    bytes))
    1636624309: Received DISCONNECT from
    auto-66D62DF4-D085-B93E-A3F7-859C745218AD
    1636624309: Client auto-66D62DF4-D085-B93E-A3F7-859C745218AD
    disconnected.
    1636624323: New connection from 127.0.0.1:60130
    <http://127.0.0.1:60130> on port 1888.
    1636624323: New client connected from 127.0.0.1:60130
    <http://127.0.0.1:60130> as
    auto-B3D3304F-9E2D-2A3D-29BB-0D3F213DE0F9 (p2, c1, k60).
    1636624323: No will message specified.
    1636624323: Sending CONNACK to
    auto-B3D3304F-9E2D-2A3D-29BB-0D3F213DE0F9
    (0, 0)
    1636624323: Received PUBLISH from
    auto-B3D3304F-9E2D-2A3D-29BB-0D3F213DE0F9 (d0, q0, r0, m0, 'foo',
    ... (0
    bytes))
    1636624323: Received DISCONNECT from
    auto-B3D3304F-9E2D-2A3D-29BB-0D3F213DE0F9
    1636624323: Client auto-B3D3304F-9E2D-2A3D-29BB-0D3F213DE0F9
    disconnected.





    On 11/11/2021 09:45, Andrew Holt wrote:
     > Hi,
     >
     > It's my own fault.
     >
     > On my (dev) network, somewhere, I have a client that is publishing a
     > message with a NULL topic.
     >
     > What I would like to do is to find the IP address of the publisher.
     >
     > If there is some way to get the broker to log the source of a
    message
     > that would be ideal, but I'm open to other suggestions.
     >
     > Thanks,
     > Andrew
     >
     > P.S. It's my own fault.
     >
     > _______________________________________________
     > mosquitto-dev mailing list
     > mosquitto-dev@xxxxxxxxxxx <mailto:mosquitto-dev@xxxxxxxxxxx>
     > To unsubscribe from this list, visit
    https://www.eclipse.org/mailman/listinfo/mosquitto-dev
    <https://www.eclipse.org/mailman/listinfo/mosquitto-dev>
     >

-- https://www.hardill.me.uk/wordpress
    <https://www.hardill.me.uk/wordpress>
    https://github.com/hardillb <https://github.com/hardillb>
    https://about.me/hardillb <https://about.me/hardillb>
    https://flickr.com/photos/hardillb/
    <https://flickr.com/photos/hardillb/>
    https://keybase.io/hardillb <https://keybase.io/hardillb>
    _______________________________________________
    mosquitto-dev mailing list
    mosquitto-dev@xxxxxxxxxxx <mailto:mosquitto-dev@xxxxxxxxxxx>
    To unsubscribe from this list, visit
    https://www.eclipse.org/mailman/listinfo/mosquitto-dev
    <https://www.eclipse.org/mailman/listinfo/mosquitto-dev>


_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev


--
https://www.hardill.me.uk/wordpress
https://github.com/hardillb
https://about.me/hardillb
https://flickr.com/photos/hardillb/
https://keybase.io/hardillb


Back to the top