Guest User

Untitled

a guest
Nov 7th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. bin/plugin --install elasticsearch/watcher/latest
  2. bin/plugin --install elasticsearch/license/latest
  3.  
  4. ES_HOME/bin/elasticsearch
  5.  
  6. curl -XGET 'http://localhost:9200/_watcher/stats?pretty'
  7.  
  8. PUT /_watcher/watch/log_error_watch
  9. {
  10. "trigger": {
  11. "schedule": {
  12. "interval": "10m"
  13. }
  14. },
  15. "input": {
  16. "search": {
  17. "request": {
  18. "indices": [
  19. "logs"
  20. ],
  21. "body": {
  22. "query": {
  23. "match": {
  24. "message": "error"
  25. }
  26. }
  27. }
  28. }
  29. }
  30. },
  31. "condition": {
  32. "compare": {
  33. "ctx.payload.hits.total": {
  34. "gt": 0
  35. }
  36. }
  37. },
  38. "actions": {
  39. "send_email": {
  40. "email": {
  41. "to": "<username>@<domainname>",
  42. "subject": "Cluster logs",
  43. "body": "Cluster Error Logs ",
  44. "attach_data": true
  45. }
  46. }
  47. }
  48. }
  49.  
  50. watcher.actions.email.service.account:
  51. work:
  52. profile: gmail
  53. email_defaults:
  54. from: <email>
  55. smtp:
  56. auth: true
  57. starttls.enable: true
  58. host: smtp.gmail.com
  59. port: 587
  60. user: <username>
  61. password: <password>
  62.  
  63. curl -XDELETE'http://localhost:9200/_watcher/watch/log_error_watch'
  64.  
  65. bin/elasticsearch-plugin install x-pack
  66. bin/kibana-plugin install x-pack
  67.  
  68. xpack.notification.email.account:
  69. outlook_account:
  70. profile: outlook
  71. email_defaults:
  72. from: <sender-email>
  73. smtp:
  74. auth: true
  75. starttls.enable: true
  76. host: smtp-mail.outlook.com
  77. port: 587
  78. user: <username>
  79. password: <password>
  80.  
  81. PUT _xpack/watcher/watch/error_report
  82. {
  83. "trigger": {
  84. "schedule": {
  85. "interval": "1h" <OR TIME INTERVAL TO MONITOR AND ALERT>
  86. }
  87. },
  88. "input": {
  89. "search": {
  90. "request": {
  91. "indices": [
  92. "logs"
  93. ],
  94. "body": {
  95. "query": {
  96. "match": {
  97. "message": "error"
  98. }
  99. }
  100. }
  101. }
  102. }
  103. },
  104. "actions": {
  105. "send_email": {
  106. "email": {
  107. "to": "<YOUR EMAIL>",
  108. "subject": "Cluster logs",
  109. "body": "Cluster Error Logs ",
  110. "attach_data": true
  111. }
  112. }
  113. }
  114. }
  115.  
  116. DELETE _xpack/watcher/watch/log_error_watch
Add Comment
Please, Sign In to add comment