Audit log configuration failure


#1

We are running Couchbase 4.1 on Windows 2012 R2. When we try to enable audit log via the admin gui nothing happens. Checking the check box and hitting save just returns the page with the checkbox still unchecked.

We decided to try the same process using couchbase-cli to see if an error is thrown. Here are two attempts:

C:\Program Files\Couchbase\Server\bin>couchbase-cli setting-audit -c dcxxxa.corp.dom:8091 -u Administrator -p XXXXX --audit-enabled 1 --audit-log-path "c:/Program Files/Couchbase/Server/var/lib/couchbase/logs"
ERROR: unable to set audit settings (500) Internal Server Error
[“Unexpected server error, request logged.”]

C:\Program Files\Couchbase\Server\bin>couchbase-cli setting-audit -c dcxxxa.corp.dom:8091 -u Administrator -p XXXXX --audit-enabled 1 --audit-log-path "c:\Program Files\Couchbase\Server\var\lib\couchbase\logs"
ERROR: unable to set audit settings (500) Internal Server Error
[“Unexpected server error, request logged.”]

The corresponding error in error.log is:

ns_server:error,2016-03-22T15:27:58.547-04:00,ns_1@dccbp01a.corp.dom:ns_config<0.143.0>:ns_config:handle_call:905]Failed to update config: {throw,{config_key_not_found,audit}}
Stacktrace:
[{ns_config,’-update_key/2-fun-0-’,4,[{file,“src/ns_config.erl”},{line,336}]},
{ns_config,handle_call,3,[{file,“src/ns_config.erl”},{line,893}]},
{gen_server,handle_msg,5,[{file,“gen_server.erl”},{line,585}]},
{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,239}]}]
[ns_server:error,2016-03-22T15:27:58.547-04:00,ns_1@dcxxxa.corp.dom:<0.18600.497>:menelaus_web:loop:184]Server error during processing: [“web request failed”,
{path,"/settings/audit"},
{method,‘POST’},
{type,error},
{what,
{badmatch,
{throw,
{config_key_not_found,audit},
[{ns_config,’-update_key/2-fun-0-’,4,
[{file,“src/ns_config.erl”},{line,336}]},
{ns_config,handle_call,3,
[{file,“src/ns_config.erl”},{line,893}]},
{gen_server,handle_msg,5,
[{file,“gen_server.erl”},{line,585}]},
{proc_lib,init_p_do_apply,3,
[{file,“proc_lib.erl”},{line,239}]}]}}},
{trace,
[{ns_config,set_sub,2,
[{file,“src/ns_config.erl”},{line,402}]},
{menelaus_web,
’-handle_settings_audit_post/1-fun-0-’,2,
[{file,“src/menelaus_web.erl”},
{line,3924}]},
{request_throttler,do_request,3,
[{file,“src/request_throttler.erl”},
{line,59}]},
{menelaus_web,loop,2,
[{file,“src/menelaus_web.erl”},
{line,162}]},
{mochiweb_http,headers,5,
[{file,
“c:/Jenkins/workspace/sherlock-windows/couchbase/couchdb/src/mochiweb/mochiweb_http.erl”},
{line,94}]},
{proc_lib,init_p_do_apply,3,
[{file,“proc_lib.erl”},{line,239}]}]}]

Does any one have ideas on what is wrong?


#2

The problem that you have reported is the result of a known issue and there is a workaround to have the cluster configuration reloaded.

What you can do is use the curl command against the REST API diag endpoint to ask the cluster to reload its configuration. This will have no negative implications and you can use the curl that is bundled with Couchbase Server by running the command on one of the nodes.

It only has to be run once against one node to refresh configuration cluster wide:

C:\Program Files\Couchbase\Server\bin\curl -u : -v http://:8091/diag/eval -d '[gen_server:call({ns_config, N}, reload) || N <- ns_node_disco:nodes_wanted()].'
Replace the following placeholder tokens in the above example with your actual values:

 <admin>: your Couchbase Server cluster administrator user name
 <password>: your Couchbase Server cluster administrator password
 <node>: the hostname or IP address of a cluster node

The expected response is an ok for each node in the cluster; so for my lab cluster of 3 nodes, the response looks like this:

  • Trying 10.1.42.10…
  • Connected to cb1.local (10.1.42.10) port 8091 (#0)
  • Server auth using Basic with user ‘Administrator’

POST /diag/eval HTTP/1.1
Host: cb1.local:8091
Authorization: Basic QWRtaW5pc3RyYXRvcjpjb3VjaGJhc2U=
User-Agent: curl/7.43.0
Accept: /
Content-Length: 79
Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 79 out of 79 bytes
    < HTTP/1.1 200 OK
    < Server: Couchbase Server
    < Pragma: no-cache
    < Date: Thu, 24 Mar 2016 14:10:14 GMT
    < Content-Type: text/plain
    < Content-Length: 10
    < Cache-Control: no-cache
    <
  • Connection #0 to host cb1.local left intact
    [ok,ok,ok]%