9.4. GET /_log

MethodGET /_log
Request None
Response Log content
Admin Privileges Requiredno
Query ArgumentsArgumentbytes
 Description Bytes to be returned
 Optionalyes
 Typenumeric
 Default1000
   
 Argumentoffset
 Description Offset in bytes where the log tail should be started
 Optionalyes
 Typenumeric
 Default0
Return Codes
200 Request completed successfully.

Gets the CouchDB log, equivalent to accessing the local log file of the corresponding CouchDB instance.

When you request the log, the response is returned as plain (UTF-8) text, with an HTTP Content-type header as text/plain.

For example, the request:

GET http://couchdb:5984/_log
Accept: */*

The raw text is returned:

[Wed, 27 Oct 2010 10:49:42 GMT] [info] [<0.23338.2>] 192.168.0.2 - - 'PUT' /authdb 401

[Wed, 27 Oct 2010 11:02:19 GMT] [info] [<0.23428.2>] 192.168.0.116 - - 'GET' /recipes/FishStew 200

[Wed, 27 Oct 2010 11:02:19 GMT] [info] [<0.23428.2>] 192.168.0.116 - - 'GET' /_session 200

[Wed, 27 Oct 2010 11:02:19 GMT] [info] [<0.24199.2>] 192.168.0.116 - - 'GET' / 200

[Wed, 27 Oct 2010 13:03:38 GMT] [info] [<0.24207.2>] 192.168.0.116 - - 'GET' /_log?offset=5 200

If you want to pick out specific parts of the log information you can use the bytes argument, which specifies the number of bytes to be returned, and offset, which specifies where the reading of the log should start, counted back from the end. For example, if you use the following request:

GET /_log?bytes=500&offset=2000

Reading of the log will start at 2000 bytes from the end of the log, and 500 bytes will be shown.