I have a requirement like want to show how many users are currently logged in the sharepoint online site and how long they are accessing it.Is there any OOTB feature available for this or any custom solution to achieve this in the Sharepoint online site. Any suggestions would be helpful. thanks in advance.
There is no OOB solution of determining how many people are currently logged into SharePoint.
SharePoint is a web technology, which means it is connectionless by design. So there really isn't such a thing as the number of users being logged on being tracked by the server.
You need to either get the 3rd party solution or developed your own solution. (you can refer to the article provided by Fox )