hcnak
hcnak

Reputation: 438

How to log fully detailed XMPP message sent and received by Prosody IM

I try to analyze a problem related to XMPP. I have two server components joined the same MUC room on Prosody IM (it's hard to make my application to print those XMPPs they received/sent , i'm using jitsi jicofo and jitsi jigasi).

So, I was wondering if it is possible to print detailed XMPP messages sent/received in MUC.

My prosody logging configuration is as below:

log = {
        { levels = {min = "debug"} , to = "console"};
}

Above configuration gave me log output as follows:

c2s55b17ab56330                                         debug   Received[c2s]: <presence type='unavailable' id='AwXwU-149' to='[email protected]/448ddea4'>
conference.example.com:muc                              debug   session [email protected]/tYARglho is leaving occupant [email protected]/448ddea4
c2s55b17b2a8300                                         debug   Sending[c2s]: <presence from='[email protected]/448ddea4' id='AwXwU-149' type='unavailable' to='[email protected]/9W3u-kLN'>
c2s55b17ae40d40                                         debug   Sending[c2s]: <presence from='[email protected]/448ddea4' id='AwXwU-149' to='[email protected]/focus32210095996901258' type='unavailable' xmlns='jabber:client'>
c2s55b17ab56330                                         debug   Sending[c2s]: <presence from='[email protected]/448ddea4' id='AwXwU-149' type='unavailable' to='[email protected]/tYARglho'>
c2s55b17ae40d40                                         debug   Received[c2s]: <iq type='set' id='1hORO-3097' to='[email protected]/448ddea4'>
c2s55b17ae40d40                                         debug   Sending[c2s]: <iq from='[email protected]/448ddea4' type='error' id='1hORO-3097' to='[email protected]/focus32210095996901258'>

Let's take line #3 above for example.

Prosody IM printed Sending[c2s]: <presence from='[email protected]/448ddea4' id='AwXwU-149' type='unavailable' to='[email protected]/9W3u-kLN'> .

However, the full XMPP message is:

<presence from='[email protected]/448ddea4' id='AwXwU-149' to='[email protected]/9W3u-kLN' type='unavailable'
    xmlns='jabber:client'>
    <x
        xmlns='http://jabber.org/protocol/muc#user'>
        <item role='none' jid='[email protected]/tYARglho' affiliation='none'/>
    </x>
</presence>

My problem is how can I optimize the logging configuration for Prosody IM to get fully detailed XMPP message as above.

And I have checked their documents:

  1. Advanced logging configuration
  2. Logging

Found nothing on this topic.

Thanks in advance.

Upvotes: 1

Views: 1596

Answers (1)

hcnak
hcnak

Reputation: 438

Well, I finally figured out how to log fully detailed XMPP message in Prosody IM.

You will need mod_stanza_debug to achieve this.

From Prosody IM website:

This module logs full stanzas to the debug log for the purposes of debugging.

It has been bundled in Prosody Installation. Just enable it by editing modules_enabled entry in Prosody global configuration file:

modules_enabled = {
        
        -- debug stanza
        "stanza_debug";

};

And finally , I can get the fully detailed XMPP message:

2021-09-01 12:10:51 c2s5577181821d0  debug    Sending[c2s]: <presence xmlns='jabber:client' from='[email protected]/01f9f60c' to='[email protected]/P2Z4rvii' id='Y81Xr-178'>
2021-09-01 12:10:51 c2s5577181821d0  debug    SEND: <presence xmlns='jabber:client' from='[email protected]/01f9f60c' to='[email protected]/P2Z4rvii' id='Y81Xr-178'><info os='l' v='13204'/><role role='participant'/><transcription-status status='OFF'/><nick xmlns='http://jabber.org/protocol/nick'>Transcriber</nick><stat name='version' value='Jigasi 1.1.SNAPSHOT'/><features xmlns='http://jabber.org/protocol/disco#info'><feature var='http://jitsi.org/protocol/jigasi'/><feature var='urn:xmpp:jingle:dtmf:0'/></features><c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://jitsi.org' ver='qo0cQuyj88ya15Au4O5PVYxqmqA='/><x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='none' role='participant' jid='[email protected]/7XCp5aWX'/></x></presence>
2021-09-01 12:10:51 c2s557717e02950  debug    Sending[c2s]: <presence xmlns='jabber:client' from='[email protected]/01f9f60c' to='[email protected]/focus32236264938572098' id='Y81Xr-178'>
2021-09-01 12:10:51 c2s557717e02950  debug    SEND: <presence xmlns='jabber:client' from='[email protected]/01f9f60c' to='[email protected]/focus32236264938572098' id='Y81Xr-178'><info os='l' v='13204'/><role role='participant'/><transcription-status status='OFF'/><nick xmlns='http://jabber.org/protocol/nick'>Transcriber</nick><stat name='version' value='Jigasi 1.1.SNAPSHOT'/><features xmlns='http://jabber.org/protocol/disco#info'><feature var='http://jitsi.org/protocol/jigasi'/><feature var='urn:xmpp:jingle:dtmf:0'/></features><c hash='sha-1' xmlns='http://jabber.org/protocol/caps' node='http://jitsi.org' ver='qo0cQuyj88ya15Au4O5PVYxqmqA='/><x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='none' role='participant' jid='[email protected]/7XCp5aWX'/></x></presence>

Upvotes: 2

Related Questions