User login/logout info in CB Server logs

Hi CB Community,

Regarding CB UI login/logout, I do find messages in http_access.log.

Any idea, which CB server log file will shows details of cbq utility login/logout ?
I checked query.log, http_access.log, info.log and tried to grep on rest of the logs but unable to locate it.

Regards,
Pratik Mehta

There is no recording of login/logout; the query engine is stateless so each request is independently authenticated and authorised.

The http access logs don’t include client requests - this would be a major bottleneck if it did.

cbq is a stand-alone client tool; it does not log to the server logs. Any cbq messages are reported to the terminal or redirected output file.

@dh Thank you for the quick response. There is no way we can trace the user login/logout ?
Also what about the App based SDK login/logout ? That too cannot be tracked ?

OR a REST API based login/logout ?

Regards,
Pratik Mehta

Remember it is stateless. There isn’t login/logout - that would be stateful - so how could you track it?

Being stateless means that each request to the server is a new connection that is authenticated & authorised independently, and is terminated when the response is sent.

There is no difference between cbq/SDK and the REST API - cbq/SDK simply build REST API requests and (in the case of the SDK) process the responses.

cbq is just a convenience that keeps note of the destination, login and supplemental information which it then uses to build a fully formed REST API request. Each statement you issue is a separate new connection with new authentication. Requests sent from an SDK are no different - the query server does not maintain “sessions”; it simply services individual REST API requests.

You can in Enterprise Edition (i.e. not in CE) enable Query request auditing to keep a log of this information if you need. (See: https://www.couchbase.com/products/editions / N1QL Auditing | Couchbase Docs )

HTH.

So @dh, there is no way to find when was a Couchbase cluster used last by an user/application. Is the understanding correct?

Suppose if we want to shutdown a Dev/QE Couchbase cluster based on when it was used last, then there is no way to identify that. Would it be correct to conclude so?

Thanks

@pccb it could possibly depend on your precise needs - you could for example use the vitals endpoint (Monitor Queries | Couchbase Docs) to detect when there has been no change in the number of requests completed. So with a little work you could establish no change over a given period and use this, but it would require some form of more active monitoring.

Thanks @dh .

Had a quick look and the vitals apply only to the query engine. KV requests and all other kind of logins (like from the UI) will still not be covered by the Vitals, correct?

Yes, vitals is for the Query service only. (The original question noted cbq hence the Query service related answer.) I’m not aware of a cluster-wide “last used” metric.