2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-get-category]]
|
2017-12-14 13:52:49 -05:00
|
|
|
=== Get Categories API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Get Categories</titleabbrev>
|
|
|
|
++++
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-06-13 16:37:35 -04:00
|
|
|
Retrieves job results for one or more categories.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Request
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`GET _xpack/ml/anomaly_detectors/<job_id>/results/categories` +
|
|
|
|
|
|
|
|
`GET _xpack/ml/anomaly_detectors/<job_id>/results/categories/<category_id>`
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-06-12 13:41:14 -04:00
|
|
|
==== Description
|
|
|
|
|
2017-06-19 21:23:58 -04:00
|
|
|
For more information about categories, see
|
|
|
|
{xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
|
|
|
|
//<<ml-configuring-categories>>.
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Path Parameters
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`job_id`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Identifier for the job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`category_id`::
|
2017-09-27 10:08:37 -04:00
|
|
|
(long) Identifier for the category. If you do not specify this optional parameter,
|
2017-04-18 18:13:21 -04:00
|
|
|
the API returns information about all categories in the job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Request Body
|
2017-04-10 19:14:26 -04:00
|
|
|
|
2017-04-28 12:14:53 -04:00
|
|
|
`page`::
|
|
|
|
`from`:::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Skips the specified number of categories.
|
2017-04-28 12:14:53 -04:00
|
|
|
`size`:::
|
2017-04-11 22:26:18 -04:00
|
|
|
(integer) Specifies the maximum number of categories to obtain.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Results
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
The API returns the following information:
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-10 19:14:26 -04:00
|
|
|
`categories`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(array) An array of category objects. For more information, see
|
2017-06-19 21:23:58 -04:00
|
|
|
<<ml-results-categories,Categories>>.
|
2017-04-25 17:08:29 -04:00
|
|
|
|
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Authorization
|
2017-04-25 17:08:29 -04:00
|
|
|
|
|
|
|
You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
|
|
|
|
privileges to use this API. You also need `read` index privilege on the index
|
|
|
|
that stores the results. The `machine_learning_admin` and `machine_learning_user`
|
|
|
|
roles provide these privileges. For more information, see
|
2017-06-19 21:23:58 -04:00
|
|
|
{xpack-ref}/security-privileges.html[Security Privileges] and
|
|
|
|
{xpack-ref}/built-in-roles.html[Built-in Roles].
|
|
|
|
//<<security-privileges>> and <<built-in-roles>>.
|
2017-04-25 17:08:29 -04:00
|
|
|
|
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Examples
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-28 12:14:53 -04:00
|
|
|
The following example gets information about one category for the
|
2018-05-15 04:02:38 -04:00
|
|
|
`esxi_log` job:
|
2017-04-10 19:14:26 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-05-15 04:02:38 -04:00
|
|
|
GET _xpack/ml/anomaly_detectors/esxi_log/results/categories
|
2017-04-28 12:14:53 -04:00
|
|
|
{
|
|
|
|
"page":{
|
|
|
|
"size": 1
|
|
|
|
}
|
|
|
|
}
|
2017-04-10 19:14:26 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
2017-04-28 12:14:53 -04:00
|
|
|
In this example, the API returns the following information:
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
2017-04-10 19:14:26 -04:00
|
|
|
"count": 11,
|
|
|
|
"categories": [
|
|
|
|
{
|
2018-05-15 04:02:38 -04:00
|
|
|
"job_id" : "esxi_log",
|
|
|
|
"category_id" : 1,
|
|
|
|
"terms" : "Vpxa verbose vpxavpxaInvtVm opID VpxaInvtVmChangeListener Guest DiskInfo Changed",
|
|
|
|
"regex" : ".*?Vpxa.+?verbose.+?vpxavpxaInvtVm.+?opID.+?VpxaInvtVmChangeListener.+?Guest.+?DiskInfo.+?Changed.*",
|
|
|
|
"max_matching_length": 154,
|
|
|
|
"examples" : [
|
|
|
|
"Oct 19 17:04:44 esxi1.acme.com Vpxa: [3CB3FB90 verbose 'vpxavpxaInvtVm' opID=WFU-33d82c31] [VpxaInvtVmChangeListener] Guest DiskInfo Changed",
|
|
|
|
"Oct 19 17:04:45 esxi2.acme.com Vpxa: [3CA66B90 verbose 'vpxavpxaInvtVm' opID=WFU-33927856] [VpxaInvtVmChangeListener] Guest DiskInfo Changed",
|
|
|
|
"Oct 19 17:04:51 esxi1.acme.com Vpxa: [FFDBAB90 verbose 'vpxavpxaInvtVm' opID=WFU-25e0d447] [VpxaInvtVmChangeListener] Guest DiskInfo Changed",
|
|
|
|
"Oct 19 17:04:58 esxi2.acme.com Vpxa: [FFDDBB90 verbose 'vpxavpxaInvtVm' opID=WFU-bbff0134] [VpxaInvtVmChangeListener] Guest DiskInfo Changed"
|
|
|
|
],
|
|
|
|
"grok_pattern" : ".*?%{SYSLOGTIMESTAMP:timestamp}.+?Vpxa.+?%{BASE16NUM:field}.+?verbose.+?vpxavpxaInvtVm.+?opID.+?VpxaInvtVmChangeListener.+?Guest.+?DiskInfo.+?Changed.*"
|
2017-04-28 12:14:53 -04:00
|
|
|
}
|
2017-04-04 18:26:39 -04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|