Logging problematic queries and response times?


We currently have an application in production and we are facing some issues with some of our endpoints. However, as we have such a tiny timeframe now, to prevent going through every endpoint, we would like to prioritize the most problematic queries that take too long to be processed.

Even if I am not mistaken, in MySQL a feature to log such queries and their response times do exist, but do the same exists for Couchbase?


@marcog can help you with this.

1 Like

Hi Ivo,
indeed in 4.5 we do have a completed requests log, which you can access selecting from system:competed_requests.
The log holds by default the last 4000 queries lasting more than a second - this is per node.
You can change both size of the cache and query threshold via the /admin/settings n1ql endpoint.
Currently you have to do it on a per node basis - you also have to be authorised.

For example

curl -X GET http://localhost:8093/admin/settings -u Administrator:password -d ‘{ “completed-threshold”: 500, “completed-limit”: 10000 }’ sets the minimum threshold to half a second and the cache size to 10k.


1 Like

Hello @marcog,

Unfortunately we are using 4.1 version. Do you have something similar for this version?


I’m afraid it was a new feature for 4.5. It will be expanded further in Spock, but I am not aware of any plan to back port it…