get-category.asciidoc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-category]]
  4. === Get Categories API
  5. ++++
  6. <titleabbrev>Get Categories</titleabbrev>
  7. ++++
  8. Retrieves job results for one or more categories.
  9. ==== Request
  10. `GET _xpack/ml/anomaly_detectors/<job_id>/results/categories` +
  11. `GET _xpack/ml/anomaly_detectors/<job_id>/results/categories/<category_id>`
  12. ==== Description
  13. For more information about categories, see
  14. {xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
  15. ==== Path Parameters
  16. `job_id`::
  17. (string) Identifier for the job.
  18. `category_id`::
  19. (long) Identifier for the category. If you do not specify this optional parameter,
  20. the API returns information about all categories in the job.
  21. ==== Request Body
  22. `page`::
  23. `from`:::
  24. (integer) Skips the specified number of categories.
  25. `size`:::
  26. (integer) Specifies the maximum number of categories to obtain.
  27. ==== Results
  28. The API returns the following information:
  29. `categories`::
  30. (array) An array of category objects. For more information, see
  31. <<ml-results-categories,Categories>>.
  32. ==== Authorization
  33. You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
  34. privileges to use this API. You also need `read` index privilege on the index
  35. that stores the results. The `machine_learning_admin` and `machine_learning_user`
  36. roles provide these privileges. For more information, see
  37. {xpack-ref}/security-privileges.html[Security Privileges] and
  38. {xpack-ref}/built-in-roles.html[Built-in Roles].
  39. ==== Examples
  40. The following example gets information about one category for the
  41. `esxi_log` job:
  42. [source,js]
  43. --------------------------------------------------
  44. GET _xpack/ml/anomaly_detectors/esxi_log/results/categories
  45. {
  46. "page":{
  47. "size": 1
  48. }
  49. }
  50. --------------------------------------------------
  51. // CONSOLE
  52. // TEST[skip:todo]
  53. In this example, the API returns the following information:
  54. [source,js]
  55. ----
  56. {
  57. "count": 11,
  58. "categories": [
  59. {
  60. "job_id" : "esxi_log",
  61. "category_id" : 1,
  62. "terms" : "Vpxa verbose vpxavpxaInvtVm opID VpxaInvtVmChangeListener Guest DiskInfo Changed",
  63. "regex" : ".*?Vpxa.+?verbose.+?vpxavpxaInvtVm.+?opID.+?VpxaInvtVmChangeListener.+?Guest.+?DiskInfo.+?Changed.*",
  64. "max_matching_length": 154,
  65. "examples" : [
  66. "Oct 19 17:04:44 esxi1.acme.com Vpxa: [3CB3FB90 verbose 'vpxavpxaInvtVm' opID=WFU-33d82c31] [VpxaInvtVmChangeListener] Guest DiskInfo Changed",
  67. "Oct 19 17:04:45 esxi2.acme.com Vpxa: [3CA66B90 verbose 'vpxavpxaInvtVm' opID=WFU-33927856] [VpxaInvtVmChangeListener] Guest DiskInfo Changed",
  68. "Oct 19 17:04:51 esxi1.acme.com Vpxa: [FFDBAB90 verbose 'vpxavpxaInvtVm' opID=WFU-25e0d447] [VpxaInvtVmChangeListener] Guest DiskInfo Changed",
  69. "Oct 19 17:04:58 esxi2.acme.com Vpxa: [FFDDBB90 verbose 'vpxavpxaInvtVm' opID=WFU-bbff0134] [VpxaInvtVmChangeListener] Guest DiskInfo Changed"
  70. ],
  71. "grok_pattern" : ".*?%{SYSLOGTIMESTAMP:timestamp}.+?Vpxa.+?%{BASE16NUM:field}.+?verbose.+?vpxavpxaInvtVm.+?opID.+?VpxaInvtVmChangeListener.+?Guest.+?DiskInfo.+?Changed.*"
  72. }
  73. ]
  74. }
  75. ----