get-category.asciidoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. [role="xpack"]
  2. [[ml-get-category]]
  3. === Get Categories API
  4. ++++
  5. <titleabbrev>Get Categories</titleabbrev>
  6. ++++
  7. Retrieves job results for one or more categories.
  8. ==== Request
  9. `GET _xpack/ml/anomaly_detectors/<job_id>/results/categories` +
  10. `GET _xpack/ml/anomaly_detectors/<job_id>/results/categories/<category_id>`
  11. ==== Description
  12. For more information about categories, see
  13. {xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
  14. //<<ml-configuring-categories>>.
  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. //<<security-privileges>> and <<built-in-roles>>.
  40. ==== Examples
  41. The following example gets information about one category for the
  42. `esxi_log` job:
  43. [source,js]
  44. --------------------------------------------------
  45. GET _xpack/ml/anomaly_detectors/esxi_log/results/categories
  46. {
  47. "page":{
  48. "size": 1
  49. }
  50. }
  51. --------------------------------------------------
  52. // CONSOLE
  53. // TEST[skip:todo]
  54. In this example, the API returns the following information:
  55. [source,js]
  56. ----
  57. {
  58. "count": 11,
  59. "categories": [
  60. {
  61. "job_id" : "esxi_log",
  62. "category_id" : 1,
  63. "terms" : "Vpxa verbose vpxavpxaInvtVm opID VpxaInvtVmChangeListener Guest DiskInfo Changed",
  64. "regex" : ".*?Vpxa.+?verbose.+?vpxavpxaInvtVm.+?opID.+?VpxaInvtVmChangeListener.+?Guest.+?DiskInfo.+?Changed.*",
  65. "max_matching_length": 154,
  66. "examples" : [
  67. "Oct 19 17:04:44 esxi1.acme.com Vpxa: [3CB3FB90 verbose 'vpxavpxaInvtVm' opID=WFU-33d82c31] [VpxaInvtVmChangeListener] Guest DiskInfo Changed",
  68. "Oct 19 17:04:45 esxi2.acme.com Vpxa: [3CA66B90 verbose 'vpxavpxaInvtVm' opID=WFU-33927856] [VpxaInvtVmChangeListener] Guest DiskInfo Changed",
  69. "Oct 19 17:04:51 esxi1.acme.com Vpxa: [FFDBAB90 verbose 'vpxavpxaInvtVm' opID=WFU-25e0d447] [VpxaInvtVmChangeListener] Guest DiskInfo Changed",
  70. "Oct 19 17:04:58 esxi2.acme.com Vpxa: [FFDDBB90 verbose 'vpxavpxaInvtVm' opID=WFU-bbff0134] [VpxaInvtVmChangeListener] Guest DiskInfo Changed"
  71. ],
  72. "grok_pattern" : ".*?%{SYSLOGTIMESTAMP:timestamp}.+?Vpxa.+?%{BASE16NUM:field}.+?verbose.+?vpxavpxaInvtVm.+?opID.+?VpxaInvtVmChangeListener.+?Guest.+?DiskInfo.+?Changed.*"
  73. }
  74. ]
  75. }
  76. ----