[ejabberd] reading session data

Badlop badlop at gmail.com
Mon Apr 18 21:49:56 MSD 2011

I found an ejabberd command for some of your requirements. I first
reply to you, and later show howto.

2011/4/18 Daniel Dormont <dan at greywallsoftware.com>:
> I have a couple of use cases that I am interested in figuring out how to do using ejabberd. Can anyone guide me?
> 1) Given a user ID, host and resource, find out

Yes, but you'll have to filter by resource the output provided by the command.

> when that session was established,

Yes, but the command provides the session uptime in seconds.

> and when it last sent a packet

No, ejabberd doesn't keep track of this.

> 2) Also given the above, if the user is connected via http_bind,

Yes, the command shows the connection method.

> find out when the last activity on that http_bind connection was

Not possible, like before.

> and, if possible, from what client IP

Yes, the command provides the client IP and port.

Install mod_admin_extral.erl and use this command:

$ ejabberdctl help user_sessions_info

  Command Name: user_sessions_info

  Arguments: user::string

  Returns: sessions_info::[ session::{ connection::string,
                                       statustext::string } ]

  Tags: session

  Description: Get information about all sessions of a user

$ ejabberdctl user_sessions_info badlop localhost
c2s          55646   8       ejabberd at localhost
 10      away         tkab    hey you
http_bind       40518   50      ejabberd at localhost      34
    available   Gajim


More information about the ejabberd mailing list