How to get the list of users currently logged in to a server for any web service?
Note that you cannot get a list of "all users logged into a web application".  You can get a list of "all users who have recently authenticated", or possibly "all users with a valid authentication token", but due to the stateless nature of web connections, the concept of "currently logged in" is a tricky one (if I close my browser window, am I "logged out"?  What if I open a connection in a new window -- have I logged back in, or was I logged in the whole time?).
Having said that, all of the web applications you've named have their own mechanism for handling user authentication.  Unless you have configured some sort of single sign-on (SSO) solution, you'll have to query each application individually to get information about currently authenticated users.  If you are working with a number of web applications, setting up single sign-on can be incredibly convenient, but depending on the web applications in question can be tricky to configure.
Be careful of thinking in terms of "client machines", because that is something else that's a tricky concept.  A bunch of people using a residential or hotel internet connection may all appear to come from the same ip address, even though there are a number of clients.  Several people may share a single computer, or someone may open multiple browser sessions to the application.
I am planning to install bugzilla/trac, mediawiki and some other web services on a server via apache. I would like to know if there is a way to track which all users(username of the specific web service from different client machines ie) are logged into the server.
I am thinking of creating a database, and doing some logic with that. Before that if there is any simpler method then I would like to go for that.
This is my first time with server stuff and apache. 
Thanks in advance