Retrieving Log Information

    +
    Diagnostic and log information can be retrieved by using the GET method with the /diag and the /sasl_logs URIs.

    HTTP method and URIs

    GET /diag
    
    GET /sasl_logs/[log-name]

    Description

    The GET /diag http method and URI returns general Couchbase Server diagnostic information.

    The GET /sasl_logs http method and URI returns information in a Couchbase Server log file.

    For general information on logging and log files, including the location of all log files, see Manage Logging.

    Curl Syntax

    curl -v -X GET -u [admin]:[password] http://[hostname]:8091/diag
    
    curl -v -X GET -u [admin]:[password] http://[hostname]:8091/sasl_logs/[log-name]

    The log-name argument can be any one of the following, each of which is a Couchbase Server log file:

    audit

    babysitter

    couchdb

    debug

    error

    goxdcr

    http_access

    info

    json_rpc

    mapreduce_errors

    memcached

    metakv

    ns_couchdb

    reports

    ssl_proxy

    stats

    views

    xdcr_target

    If no log-name argument is specified, the default value is debug; whereby the contents of the debug.log file are displayed.

    Responses

    For both URIs, success gives 200 OK, and displays the returned content. Failure to authenticate gives 401 Unauthorized. When GET /sasl_logs is used, a log-name that is either incorrectly specified, or corresponds to a log file that does not currently exist, gives 404 Object Not Found.

    Examples

    The following examples show how to return diagnostic information and log-file content.

    Returning Diagnostic Information

    The following example uses GET /diag to return Couchbase Server diagnostic information:

    curl -v -X GET -u Administrator:password \
    http://10.143.194.101:8091/diag

    If successful, this returns (extensive) output whose initial section resembles the following:

    logs:
    -------------------------------
    2020-02-07T04:30:30.429-08:00, ns_cookie_manager:3:info:cookie update(ns_1@cb.local) - Initial otp cookie generated: {sanitized,
                                      <<"ioEsqBp4LGNDxWCwMhypDPgfIrcseb1GCgSBno+G7d8=">>}
    2020-02-07T04:30:30.580-08:00, menelaus_sup:1:info:web start ok(ns_1@cb.local) - Couchbase Server has started on web port 8091 on node 'ns_1@cb.local'. Version:
     "6.5.0-4960-enterprise".
    2020-02-07T04:30:30.816-08:00, mb_master:0:info:message(ns_1@cb.local) - I'm the only node, so I'm the master.
    2020-02-07T04:30:30.880-08:00, compat_mode_manager:0:warning:message(ns_1@cb.local) - Changed cluster compat mode from undefined to [6,5]
    2020-02-07T04:30:30.937-08:00, memcached_config_mgr:0:info:message(ns_1@cb.local) - Hot-reloaded memcached.json for config change of the following keys: [<<"cli
    ent_cert_auth">>,

    Returning Log-File Content

    The following example uses GET /sasl_logs with the stats endpoint, to return the contents of the stats.log log file:

    curl -v -X GET -u Administrator:password \
    http://10.143.194.101:8091/sasl_logs/stats

    If successful, this returns (extensive) output, whose initial section resembles the following:

    logs_node (stats.log):
    -------------------------------
    [ns_doctor:debug,2020-02-07T04:30:30.602-08:00,ns_1@cb.local:ns_doctor<0.354.0>:ns_doctor:handle_info:182]Got initial status:
    [{'ns_1@cb.local',
         [{last_heard,-576460749154163105},
          {now,-576460749183621671},
          {active_buckets,[]},
          {ready_buckets,[]},
          {status_latency,29351},
          {outgoing_replications_safeness_level,[]},
          {incoming_replications_conf_hashes,[]},
          {meminfo,
              <<"MemTotal:        1016332 kB\nMemFree:

    See Also

    General information on logging and log files, including the location of all log files, is provided in Manage Logging.