Samuel Lee wrote:
Well, I want to make sure our users aren't editing
any pages or
accessing important info while we restart those services. Our XWiki
is used quite frequently, we have several different xwiki's used in
our farm and is accessed by people across the country. We can send a
note to users, but it'd be nice to be able to make sure people aren't
using the XWiki while we restart.
Then you don't need to know which users are logged in, you need to know
who is editing pages, which is different. For that, you can do:
#foreach($userName in $xwiki.search("select distinct lock.userName from
XWikiLock as lock"))
$userName
#end
This is a crude example, as it will select also stale, uncleaned locks.
You should try to integrate a WHERE condition on the lock.date property.
As about users browsing the wiki without editing, you can't do that
without statistics. The way authentication works now, there is no
information on the server about logged in users, as each request
validates the user (slower, but safer). You could instead do the following:
Edit the logging configuration (as in
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Logging ) and add
the following rule:
log4j.logger.com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl=info
Now you will see all the authenticated users in the log, you just need
to write a nice shell script that selects what you want, for example:
cat xwiki.log | grep "is authentified" | tail -200 | cut '-d[' -f1,3 |
cut -c1-19,70- | tail -1000
displays the last 1000 authentication lines, along with the date,
cat xwiki.log | grep "is authentified" | cut -d- -f5 | cut '-d ' -f 3 |
tail -1000 | sort | uniq
displays the users from the last 1000 requests.
On Oct 9, 2008, at 2:12 PM, Vincent Massol wrote:
> Hi Sam,
>
> I'm curious, why do you need to know if people are logged in?
>
> Thanks
> -Vincent
>
> On Oct 9, 2008, at 11:07 PM, Samuel Lee wrote:
>
>> Is there any way to check for logged in users if you have stats
>> turned
>> off. We disabled stats to improve performance on our production
>> xwiki. I need to restart the tomcat and mysql services, but I can't
>> tell if people are logged in. Any ideas?
>>
>> Sam
--
Sergiu Dumitriu
http://purl.org/net/sergiu/