1

我尝试分析一个与 XMPP 相关的问题。我有两个服务器组件在 Prosody IM 上加入了同一个 MUC 房间(很难让我的应用程序打印他们接收/发送的那些 XMPP,我使用的是 jitsi jicofo 和 jitsi jigasi)。

所以,我想知道是否可以打印在 MUC 中发送/接收的详细 XMPP 消息。

我的韵律日志配置如下:

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

上面的配置给了我如下的日志输出:

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

让我们以上面的第 3 行为例。

韵律 IM 印刷Sending[c2s]: <presence from='123456789@conference.example.com/448ddea4' id='AwXwU-149' type='unavailable' to='tiqmjoyi7d3rr69-@example.com/9W3u-kLN'>

但是,完整的 XMPP 消息是:

<presence from='123456789@conference.example.com/448ddea4' id='AwXwU-149' to='tiqmjoyi7d3rr69-@example.com/9W3u-kLN' type='unavailable'
    xmlns='jabber:client'>
    <x
        xmlns='http://jabber.org/protocol/muc#user'>
        <item role='none' jid='qvagnu083x5-bl78@example.com/tYARglho' affiliation='none'/>
    </x>
</presence>

我的问题是如何优化 Prosody IM 的日志记录配置,以获得如上所述的完整详细的 XMPP 消息。

我检查了他们的文件:

  1. 高级日志记录配置
  2. 日志记录

在这个话题上没有找到任何东西。

提前致谢。

4

1 回答 1

2

好吧,我终于想出了如何在 Prosody IM 中记录完整详细的 XMPP 消息。

您将需要mod_stanza_debug实现这一目标。

来自Prosody IM 网站

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

它已捆绑在 Prosody 安装中。只需通过编辑modules_enabledProsody 全局配置文件中的条目来启用它:

modules_enabled = {
        
        -- debug stanza
        "stanza_debug";

};

最后,我可以获得完整详细的 XMPP 消息:

2021-09-01 12:10:51 c2s5577181821d0  debug    Sending[c2s]: <presence xmlns='jabber:client' from='123456789@conference.example.com/01f9f60c' to='jw5c6zuqagigmxyc@example.com/P2Z4rvii' id='Y81Xr-178'>
2021-09-01 12:10:51 c2s5577181821d0  debug    SEND: <presence xmlns='jabber:client' from='123456789@conference.example.com/01f9f60c' to='jw5c6zuqagigmxyc@example.com/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='tfccagysjks6zjon@example.com/7XCp5aWX'/></x></presence>
2021-09-01 12:10:51 c2s557717e02950  debug    Sending[c2s]: <presence xmlns='jabber:client' from='123456789@conference.example.com/01f9f60c' to='focus@auth.example.com/focus32236264938572098' id='Y81Xr-178'>
2021-09-01 12:10:51 c2s557717e02950  debug    SEND: <presence xmlns='jabber:client' from='123456789@conference.example.com/01f9f60c' to='focus@auth.example.com/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='tfccagysjks6zjon@example.com/7XCp5aWX'/></x></presence>
于 2021-09-01T13:03:42.473 回答