Watcher issue in x-pack

Hi guys,

I installed ES. logstash. kibana 5.0 with x-pack.

when I am trying to run following command

curl --user watching:watching -XGET 'http://localhost:9200/.watcher-history*/_search?pretty'

I am getting following error

"payload" : {
"error" : {
"root_cause" : [ {
"type" : "security_exception",
"reason" : "missing authentication token for REST request [/_cluster/health]",
"header" : {
"WWW-Authenticate" : "Basic realm="shield""
}
} ],
"type" : "security_exception",
"reason" : "missing authentication token for REST request [/_cluster/health]",
"header" : {
"WWW-Authenticate" : "Basic realm="shield""
}
},
"status" : 401
},
Can you please help me to resolve this.

Thanks in advance

Uday.K

Hi Uday,

A few questions, is the error you are getting directly from the curl request you posted? It appears to be a different request /_cluster/health. Do you have have any realm configuration or custom settings?

-Jay

Hi Jay,

these are steps we followed

PUT /_watcher/watch/cluster_health_watch
{
"trigger" : {
"schedule" : { "interval" : "10s" }
},
"input" : {
"http" : {
"request" : {
"host" : "localhost/IP",
"port" : 9200,
"path" : "/_cluster/health"
}
}
}
}

  1. first I scheduled watcher and then tried to get results using curl
    which is - curl --user watching:watching -XGET 'http://IP:9200/.watcher-history*/_search?pretty'
  2. We dont have any custom realm, I am using esusers (default) realm.

Thanks,
Uday.K

Ah I see. You will need to provide credentials for your watch to execute, which our documentation does not clearly state. I'll open a issue to get this corrected. For details on how to do this, see:

https://www.elastic.co/guide/en/x-pack/current/input.html#_calling_external_webservices

Thanks Jay, it worked.