[[troubleshooting]]
== Troubleshooting

Here are some common issues you might encounter while using Watcher. If you don't see a solution
to your problem here, post a question to the {forum}[Watcher Discussion Forum]. 

[float]
=== Troubleshooting a New Watcher Installation

If Watcher or Elasticsearch fail to start up properly after installation:

* Make sure you are running Elasticsearch 1.5 or later.
* Make sure the License plugin is installed on every node in the cluster.
* If you are using Shield, make sure you are running Shield 1.2.2 or later.
* Make sure Watcher is installed on every node in the cluster.
* Make sure all plugin versions are compatible with the Elasticsearch version. 

[float]
=== Logstash Can't Connect to Elasticsearch after Installing Watcher

By default, Logstash uses the `node` protocol. When you use the node protocol, the Logstash 
instance joins the Elasticsearch cluster. Because Watcher requires all instances in the cluster
to have the License plugin, Logstash cannot join the cluster unless it has the License plugin. 
You can <<logstash-integration, install the Logstash License plugin>> or use the `transport` or 
`http` protocol to ship data to Elasticsearch.

[float]
=== Dynamic Mapping Error When Trying to Add a Watch

If you get the error _Dynamic Mapping is Disabled_ when you try to add a watch, verify that the 
index mappings for the .watches index are available. You can do that by submitting the following 
request:

[source,js]
-------------------------------------------------- 
GET .watches/_mapping
--------------------------------------------------
// AUTOSENSE 

If the index mappings are missing, follow these steps to restore the correct mappings:

. Stop the node.
. Add the configuration setting `watcher.index.rest.direct_access : true` to `elasticsearch.yml`.
. Restart the node.
. Delete the `.watches` index:
+
[source,js]
-------------------------------------------------- 
DELETE .watches
--------------------------------------------------
+
. Disable direct access to the `.watches` index:
.. Stop the node.
.. Remove `watcher.index.rest.direct_access : true` from `elasticsearch.yml`.
.. Restart the node.

[float]
=== Unable to Send Email

If you get an authentication error that indicates that you need to continue the sign-in process
from a web browser when Watcher attempts to send email, you need to configure Gmail to
https://support.google.com/accounts/answer/6010255?hl=en[Allow Less Secure Apps to access your account]. 

If you have two-step verification enabled for your email account, you must generate and use an App
Specific password to send email from Watcher. For more information, see:

- Gmail: https://support.google.com/accounts/answer/185833?hl=en[Sign in using App Passwords] 
- Outlook.com: http://windows.microsoft.com/en-us/windows/app-passwords-two-step-verification[App passwords and two-step verification]

[float]
=== Watcher Not Responsive

Keep in mind that there's no built-in validation of scripts that you add to a watch. Buggy or
deliberately malicious scripts can negatively impact Watcher performance. For example, if you
add multiple watches with buggy script conditions in a short period of time, Watcher might be
temporarily unable to process watches until the bad watches time out.



