resultsresource.asciidoc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. [role="xpack"]
  2. [[ml-results-resource]]
  3. === Results Resources
  4. Several different result types are created for each job. You can query anomaly
  5. results for _buckets_, _influencers_, and _records_ by using the results API.
  6. Summarized bucket results over multiple jobs can be queried as well; those
  7. results are called _overall buckets_.
  8. Results are written for each `bucket_span`. The timestamp for the results is the
  9. start of the bucket time interval.
  10. The results include scores, which are calculated for each anomaly result type and
  11. each bucket interval. These scores are aggregated in order to reduce noise, and
  12. normalized in order to identify and rank the most mathematically significant
  13. anomalies.
  14. Bucket results provide the top level, overall view of the job and are ideal for
  15. alerts. For example, the bucket results might indicate that at 16:05 the system
  16. was unusual. This information is a summary of all the anomalies, pinpointing
  17. when they occurred.
  18. Influencer results show which entities were anomalous and when. For example,
  19. the influencer results might indicate that at 16:05 `user_name: Bob` was unusual.
  20. This information is a summary of all the anomalies for each entity, so there
  21. can be a lot of these results. Once you have identified a notable bucket time,
  22. you can look to see which entities were significant.
  23. Record results provide details about what the individual anomaly was, when it
  24. occurred and which entity was involved. For example, the record results might
  25. indicate that at 16:05 Bob sent 837262434 bytes, when the typical value was
  26. 1067 bytes. Once you have identified a bucket time and perhaps a significant
  27. entity too, you can drill through to the record results in order to investigate
  28. the anomalous behavior.
  29. Categorization results contain the definitions of _categories_ that have been
  30. identified. These are only applicable for jobs that are configured to analyze
  31. unstructured log data using categorization. These results do not contain a
  32. timestamp or any calculated scores. For more information, see
  33. {xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
  34. * <<ml-results-buckets,Buckets>>
  35. * <<ml-results-influencers,Influencers>>
  36. * <<ml-results-records,Records>>
  37. * <<ml-results-categories,Categories>>
  38. * <<ml-results-overall-buckets,Overall Buckets>>
  39. NOTE: All of these resources and properties are informational; you cannot
  40. change their values.
  41. [float]
  42. [[ml-results-buckets]]
  43. ==== Buckets
  44. Bucket results provide the top level, overall view of the job and are best for
  45. alerting.
  46. Each bucket has an `anomaly_score`, which is a statistically aggregated and
  47. normalized view of the combined anomalousness of all the record results within
  48. each bucket.
  49. One bucket result is written for each `bucket_span` for each job, even if it is
  50. not considered to be anomalous. If the bucket is not anomalous, it has an
  51. `anomaly_score` of zero.
  52. When you identify an anomalous bucket, you can investigate further by expanding
  53. the bucket resource to show the records as nested objects. Alternatively, you
  54. can access the records resource directly and filter by the date range.
  55. A bucket resource has the following properties:
  56. `anomaly_score`::
  57. (number) The maximum anomaly score, between 0-100, for any of the bucket
  58. influencers. This is an overall, rate-limited score for the job. All the
  59. anomaly records in the bucket contribute to this score. This value might be
  60. updated as new data is analyzed.
  61. `bucket_influencers`::
  62. (array) An array of bucket influencer objects.
  63. For more information, see <<ml-results-bucket-influencers,Bucket Influencers>>.
  64. `bucket_span`::
  65. (number) The length of the bucket in seconds.
  66. This value matches the `bucket_span` that is specified in the job.
  67. `event_count`::
  68. (number) The number of input data records processed in this bucket.
  69. `initial_anomaly_score`::
  70. (number) The maximum `anomaly_score` for any of the bucket influencers.
  71. This is the initial value that was calculated at the time the bucket was
  72. processed.
  73. `is_interim`::
  74. (boolean) If true, this is an interim result. In other words, the bucket
  75. results are calculated based on partial input data.
  76. `job_id`::
  77. (string) The unique identifier for the job that these results belong to.
  78. `processing_time_ms`::
  79. (number) The amount of time, in milliseconds, that it took to analyze the
  80. bucket contents and calculate results.
  81. `result_type`::
  82. (string) Internal. This value is always set to `bucket`.
  83. `timestamp`::
  84. (date) The start time of the bucket. This timestamp uniquely identifies the
  85. bucket. +
  86. NOTE: Events that occur exactly at the timestamp of the bucket are included in
  87. the results for the bucket.
  88. [float]
  89. [[ml-results-bucket-influencers]]
  90. ==== Bucket Influencers
  91. Bucket influencer results are available as nested objects contained within
  92. bucket results. These results are an aggregation for each type of influencer.
  93. For example, if both `client_ip` and `user_name` were specified as influencers,
  94. then you would be able to determine when the `client_ip` or `user_name` values
  95. were collectively anomalous.
  96. There is a built-in bucket influencer called `bucket_time` which is always
  97. available. This bucket influencer is the aggregation of all records in the
  98. bucket; it is not just limited to a type of influencer.
  99. NOTE: A bucket influencer is a type of influencer. For example, `client_ip` or
  100. `user_name` can be bucket influencers, whereas `192.168.88.2` and `Bob` are
  101. influencers.
  102. An bucket influencer object has the following properties:
  103. `anomaly_score`::
  104. (number) A normalized score between 0-100, which is calculated for each bucket
  105. influencer. This score might be updated as newer data is analyzed.
  106. `bucket_span`::
  107. (number) The length of the bucket in seconds. This value matches the `bucket_span`
  108. that is specified in the job.
  109. `initial_anomaly_score`::
  110. (number) The score between 0-100 for each bucket influencer. This score is
  111. the initial value that was calculated at the time the bucket was processed.
  112. `influencer_field_name`::
  113. (string) The field name of the influencer. For example `client_ip` or
  114. `user_name`.
  115. `influencer_field_value`::
  116. (string) The field value of the influencer. For example `192.168.88.2` or
  117. `Bob`.
  118. `is_interim`::
  119. (boolean) If true, this is an interim result. In other words, the bucket
  120. influencer results are calculated based on partial input data.
  121. `job_id`::
  122. (string) The unique identifier for the job that these results belong to.
  123. `probability`::
  124. (number) The probability that the bucket has this behavior, in the range 0
  125. to 1. For example, 0.0000109783. This value can be held to a high precision
  126. of over 300 decimal places, so the `anomaly_score` is provided as a
  127. human-readable and friendly interpretation of this.
  128. `raw_anomaly_score`::
  129. (number) Internal.
  130. `result_type`::
  131. (string) Internal. This value is always set to `bucket_influencer`.
  132. `timestamp`::
  133. (date) The start time of the bucket for which these results were calculated.
  134. [float]
  135. [[ml-results-influencers]]
  136. ==== Influencers
  137. Influencers are the entities that have contributed to, or are to blame for,
  138. the anomalies. Influencer results are available only if an
  139. `influencer_field_name` is specified in the job configuration.
  140. Influencers are given an `influencer_score`, which is calculated based on the
  141. anomalies that have occurred in each bucket interval. For jobs with more than
  142. one detector, this gives a powerful view of the most anomalous entities.
  143. For example, if you are analyzing unusual bytes sent and unusual domains
  144. visited and you specified `user_name` as the influencer, then an
  145. `influencer_score` for each anomalous user name is written per bucket. For
  146. example, if `user_name: Bob` had an `influencer_score` greater than 75, then
  147. `Bob` would be considered very anomalous during this time interval in one or
  148. both of those areas (unusual bytes sent or unusual domains visited).
  149. One influencer result is written per bucket for each influencer that is
  150. considered anomalous.
  151. When you identify an influencer with a high score, you can investigate further
  152. by accessing the records resource for that bucket and enumerating the anomaly
  153. records that contain the influencer.
  154. An influencer object has the following properties:
  155. `bucket_span`::
  156. (number) The length of the bucket in seconds. This value matches the `bucket_span`
  157. that is specified in the job.
  158. `influencer_score`::
  159. (number) A normalized score between 0-100, which is based on the probability
  160. of the influencer in this bucket aggregated across detectors. Unlike
  161. `initial_influencer_score`, this value will be updated by a re-normalization
  162. process as new data is analyzed.
  163. `initial_influencer_score`::
  164. (number) A normalized score between 0-100, which is based on the probability
  165. of the influencer aggregated across detectors. This is the initial value that
  166. was calculated at the time the bucket was processed.
  167. `influencer_field_name`::
  168. (string) The field name of the influencer.
  169. `influencer_field_value`::
  170. (string) The entity that influenced, contributed to, or was to blame for the
  171. anomaly.
  172. `is_interim`::
  173. (boolean) If true, this is an interim result. In other words, the influencer
  174. results are calculated based on partial input data.
  175. `job_id`::
  176. (string) The unique identifier for the job that these results belong to.
  177. `probability`::
  178. (number) The probability that the influencer has this behavior, in the range
  179. 0 to 1. For example, 0.0000109783. This value can be held to a high precision
  180. of over 300 decimal places, so the `influencer_score` is provided as a
  181. human-readable and friendly interpretation of this.
  182. // For example, 0.03 means 3%. This value is held to a high precision of over
  183. //300 decimal places. In scientific notation, a value of 3.24E-300 is highly
  184. //unlikely and therefore highly anomalous.
  185. `result_type`::
  186. (string) Internal. This value is always set to `influencer`.
  187. `timestamp`::
  188. (date) The start time of the bucket for which these results were calculated.
  189. NOTE: Additional influencer properties are added, depending on the fields being
  190. analyzed. For example, if it's analyzing `user_name` as an influencer, then a
  191. field `user_name` is added to the result document. This information enables you to
  192. filter the anomaly results more easily.
  193. [float]
  194. [[ml-results-records]]
  195. ==== Records
  196. Records contain the detailed analytical results. They describe the anomalous
  197. activity that has been identified in the input data based on the detector
  198. configuration.
  199. For example, if you are looking for unusually large data transfers, an anomaly
  200. record can identify the source IP address, the destination, the time window
  201. during which it occurred, the expected and actual size of the transfer, and the
  202. probability of this occurrence.
  203. There can be many anomaly records depending on the characteristics and size of
  204. the input data. In practice, there are often too many to be able to manually
  205. process them. The {xpackml} features therefore perform a sophisticated
  206. aggregation of the anomaly records into buckets.
  207. The number of record results depends on the number of anomalies found in each
  208. bucket, which relates to the number of time series being modeled and the number of
  209. detectors.
  210. A record object has the following properties:
  211. `actual`::
  212. (array) The actual value for the bucket.
  213. `bucket_span`::
  214. (number) The length of the bucket in seconds.
  215. This value matches the `bucket_span` that is specified in the job.
  216. `by_field_name`::
  217. (string) The name of the analyzed field. This value is present only if
  218. it is specified in the detector. For example, `client_ip`.
  219. `by_field_value`::
  220. (string) The value of `by_field_name`. This value is present only if
  221. it is specified in the detector. For example, `192.168.66.2`.
  222. `causes`::
  223. (array) For population analysis, an over field must be specified in the
  224. detector. This property contains an array of anomaly records that are the
  225. causes for the anomaly that has been identified for the over field. If no
  226. over fields exist, this field is not present. This sub-resource contains
  227. the most anomalous records for the `over_field_name`. For scalability reasons,
  228. a maximum of the 10 most significant causes of the anomaly are returned. As
  229. part of the core analytical modeling, these low-level anomaly records are
  230. aggregated for their parent over field record. The causes resource contains
  231. similar elements to the record resource, namely `actual`, `typical`,
  232. `*_field_name` and `*_field_value`. Probability and scores are not applicable
  233. to causes.
  234. `detector_index`::
  235. (number) A unique identifier for the detector.
  236. `field_name`::
  237. (string) Certain functions require a field to operate on, for example, `sum()`.
  238. For those functions, this value is the name of the field to be analyzed.
  239. `function`::
  240. (string) The function in which the anomaly occurs, as specified in the
  241. detector configuration. For example, `max`.
  242. `function_description`::
  243. (string) The description of the function in which the anomaly occurs, as
  244. specified in the detector configuration.
  245. `influencers`::
  246. (array) If `influencers` was specified in the detector configuration, then
  247. this array contains influencers that contributed to or were to blame for an
  248. anomaly.
  249. `initial_record_score`::
  250. (number) A normalized score between 0-100, which is based on the
  251. probability of the anomalousness of this record. This is the initial value
  252. that was calculated at the time the bucket was processed.
  253. `is_interim`::
  254. (boolean) If true, this is an interim result. In other words, the anomaly
  255. record is calculated based on partial input data.
  256. `job_id`::
  257. (string) The unique identifier for the job that these results belong to.
  258. `over_field_name`::
  259. (string) The name of the over field that was used in the analysis. This value
  260. is present only if it was specified in the detector. Over fields are used
  261. in population analysis. For example, `user`.
  262. `over_field_value`::
  263. (string) The value of `over_field_name`. This value is present only if it
  264. was specified in the detector. For example, `Bob`.
  265. `partition_field_name`::
  266. (string) The name of the partition field that was used in the analysis. This
  267. value is present only if it was specified in the detector. For example,
  268. `region`.
  269. `partition_field_value`::
  270. (string) The value of `partition_field_name`. This value is present only if
  271. it was specified in the detector. For example, `us-east-1`.
  272. `probability`::
  273. (number) The probability of the individual anomaly occurring, in the range
  274. 0 to 1. For example, 0.0000772031. This value can be held to a high precision
  275. of over 300 decimal places, so the `record_score` is provided as a
  276. human-readable and friendly interpretation of this.
  277. //In scientific notation, a value of 3.24E-300 is highly unlikely and therefore
  278. //highly anomalous.
  279. `record_score`::
  280. (number) A normalized score between 0-100, which is based on the probability
  281. of the anomalousness of this record. Unlike `initial_record_score`, this
  282. value will be updated by a re-normalization process as new data is analyzed.
  283. `result_type`::
  284. (string) Internal. This is always set to `record`.
  285. `timestamp`::
  286. (date) The start time of the bucket for which these results were calculated.
  287. `typical`::
  288. (array) The typical value for the bucket, according to analytical modeling.
  289. NOTE: Additional record properties are added, depending on the fields being
  290. analyzed. For example, if it's analyzing `hostname` as a _by field_, then a field
  291. `hostname` is added to the result document. This information enables you to
  292. filter the anomaly results more easily.
  293. [float]
  294. [[ml-results-categories]]
  295. ==== Categories
  296. When `categorization_field_name` is specified in the job configuration, it is
  297. possible to view the definitions of the resulting categories. A category
  298. definition describes the common terms matched and contains examples of matched
  299. values.
  300. The anomaly results from a categorization analysis are available as bucket,
  301. influencer, and record results. For example, the results might indicate that
  302. at 16:45 there was an unusual count of log message category 11. You can then
  303. examine the description and examples of that category.
  304. A category resource has the following properties:
  305. `category_id`::
  306. (unsigned integer) A unique identifier for the category.
  307. `examples`::
  308. (array) A list of examples of actual values that matched the category.
  309. `grok_pattern`::
  310. experimental[] (string) A Grok pattern that could be used in Logstash or an
  311. Ingest Pipeline to extract fields from messages that match the category. This
  312. field is experimental and may be changed or removed in a future release. The
  313. Grok patterns that are found are not optimal, but are often a good starting
  314. point for manual tweaking.
  315. `job_id`::
  316. (string) The unique identifier for the job that these results belong to.
  317. `max_matching_length`::
  318. (unsigned integer) The maximum length of the fields that matched the category.
  319. The value is increased by 10% to enable matching for similar fields that have
  320. not been analyzed.
  321. `regex`::
  322. (string) A regular expression that is used to search for values that match the
  323. category.
  324. `terms`::
  325. (string) A space separated list of the common tokens that are matched in
  326. values of the category.
  327. [float]
  328. [[ml-results-overall-buckets]]
  329. ==== Overall Buckets
  330. Overall buckets provide a summary of bucket results over multiple jobs.
  331. Their `bucket_span` equals the longest `bucket_span` of the jobs in question.
  332. The `overall_score` is the `top_n` average of the max `anomaly_score` per job
  333. within the overall bucket time interval.
  334. This means that you can fine-tune the `overall_score` so that it is more
  335. or less sensitive to the number of jobs that detect an anomaly at the same time.
  336. An overall bucket resource has the following properties:
  337. `timestamp`::
  338. (date) The start time of the overall bucket.
  339. `bucket_span`::
  340. (number) The length of the bucket in seconds. Matches the `bucket_span`
  341. of the job with the longest one.
  342. `overall_score`::
  343. (number) The `top_n` average of the max bucket `anomaly_score` per job.
  344. `jobs`::
  345. (array) An array of objects that contain the `max_anomaly_score` per `job_id`.
  346. `is_interim`::
  347. (boolean) If true, this is an interim result. In other words, the anomaly
  348. record is calculated based on partial input data.
  349. `result_type`::
  350. (string) Internal. This is always set to `overall_bucket`.