Some times we need to monitor liferay live users session. In liferay, monitoring live users is very straight forward. We no need to do any extra coding for it. Only one property can enable liferay live users sessions and from the control panel we will be able to monitor each user.
Note : By default liferay live user session is not enabled
Lets have a look in control panel for user monitoring
1. Log in as Admin.
2. Go to the control panel. Look in Users section. Click Monitoring.
3. After clicking the monitoring link we will see below interface.
Look at the message
Display of live session data is disabled. To enable, set the portal property live.users.enabled to true.
This means that live users is not enabled. To enable live users we need to set the property live.users.enabled to true
4. Now open your portal-ext.properties file. Add the below line
live.users.enabled=true
Don’t Know whats portal-ext.properties?
Those who are new to liferay they may be unaware of portal-ext.properties file. This is the file where we override liferay’s existing portal.properties file. We are not going to discuss it in detail as its out of scope. Just go to your \liferay-portal-6.2-ce-ga2\tomcat-7.0.42\webapps\ROOT\WEB-INF\classes directory of the tomcat server. If portal-ext.properties is not available in that directory then create it.
5. After changing the portal-ext.properties file we must restart our tomcat server.
6. Now follow the same step from 1 to 3. We will see something like below
In my case I have two logged in users at this time. For each logged in user there will be one raw in this interface. We can click each of the link to see in details of the user’s activity. So this is the way we can easily monitor logged in users.
Remember:
For performance reasons, this setting is usually turned off in production.
This displays Live Users and we are able to monitor which is great.
But say for instance we want to retrieve records of which users logged in for the duration of one month – is it written to any log to retrieve the history?