jobresource.asciidoc 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-job-resource]]
  4. === Job resources
  5. A job resource has the following properties:
  6. `analysis_config`::
  7. (object) The analysis configuration, which specifies how to analyze the data.
  8. See <<ml-analysisconfig, analysis configuration objects>>.
  9. `analysis_limits`::
  10. (object) Defines approximate limits on the memory resource requirements for the job.
  11. See <<ml-apilimits,analysis limits>>.
  12. `background_persist_interval`::
  13. (time units) Advanced configuration option.
  14. The time between each periodic persistence of the model.
  15. The default value is a randomized value between 3 to 4 hours, which avoids
  16. all jobs persisting at exactly the same time. The smallest allowed value is
  17. 1 hour.
  18. +
  19. --
  20. TIP: For very large models (several GB), persistence could take 10-20 minutes,
  21. so do not set the `background_persist_interval` value too low.
  22. --
  23. `create_time`::
  24. (string) The time the job was created. For example, `1491007356077`. This
  25. property is informational; you cannot change its value.
  26. `custom_settings`::
  27. (object) Advanced configuration option. Contains custom meta data about the
  28. job. For example, it can contain custom URL information as shown in
  29. {xpack-ref}/ml-configuring-url.html[Adding Custom URLs to Machine Learning Results].
  30. `data_description`::
  31. (object) Describes the data format and how APIs parse timestamp fields.
  32. See <<ml-datadescription,data description objects>>.
  33. `description`::
  34. (string) An optional description of the job.
  35. `finished_time`::
  36. (string) If the job closed or failed, this is the time the job finished,
  37. otherwise it is `null`. This property is informational; you cannot change its
  38. value.
  39. `groups`::
  40. (array of strings) A list of job groups. A job can belong to no groups or
  41. many. For example, `["group1", "group2"]`.
  42. `job_id`::
  43. (string) The unique identifier for the job. This identifier can contain
  44. lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It
  45. must start and end with alphanumeric characters. This property is
  46. informational; you cannot change the identifier for existing jobs.
  47. `job_type`::
  48. (string) Reserved for future use, currently set to `anomaly_detector`.
  49. `job_version`::
  50. (string) The version of {es} that existed on the node when the job was created.
  51. `model_plot_config`::
  52. (object) Configuration properties for storing additional model information.
  53. See <<ml-apimodelplotconfig, model plot configuration>>.
  54. `model_snapshot_id`::
  55. (string) A numerical character string that uniquely identifies the model
  56. snapshot. For example, `1491007364`. This property is informational; you
  57. cannot change its value. For more information about model snapshots, see
  58. <<ml-snapshot-resource>>.
  59. `model_snapshot_retention_days`::
  60. (long) The time in days that model snapshots are retained for the job.
  61. Older snapshots are deleted. The default value is `1`, which means snapshots
  62. are retained for one day (twenty-four hours).
  63. `renormalization_window_days`::
  64. (long) Advanced configuration option.
  65. The period over which adjustments to the score are applied, as new data is seen.
  66. The default value is the longer of 30 days or 100 `bucket_spans`.
  67. `results_index_name`::
  68. (string) The name of the index in which to store the {ml} results.
  69. The default value is `shared`,
  70. which corresponds to the index name `.ml-anomalies-shared`
  71. `results_retention_days`::
  72. (long) Advanced configuration option.
  73. The number of days for which job results are retained.
  74. Once per day at 00:30 (server time), results older than this period are
  75. deleted from Elasticsearch. The default value is null, which means results
  76. are retained.
  77. [[ml-analysisconfig]]
  78. ==== Analysis Configuration Objects
  79. An analysis configuration object has the following properties:
  80. `bucket_span`::
  81. (time units) The size of the interval that the analysis is aggregated into,
  82. typically between `5m` and `1h`. The default value is `5m`. For more
  83. information about time units, see <<time-units,Common options>>.
  84. `categorization_field_name`::
  85. (string) If this property is specified, the values of the specified field will
  86. be categorized. The resulting categories must be used in a detector by setting
  87. `by_field_name`, `over_field_name`, or `partition_field_name` to the keyword
  88. `mlcategory`. For more information, see
  89. {xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
  90. `categorization_filters`::
  91. (array of strings) If `categorization_field_name` is specified,
  92. you can also define optional filters. This property expects an array of
  93. regular expressions. The expressions are used to filter out matching sequences
  94. from the categorization field values. You can use this functionality to fine
  95. tune the categorization by excluding sequences from consideration when
  96. categories are defined. For example, you can exclude SQL statements that
  97. appear in your log files. For more information, see
  98. {xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
  99. This property cannot be used at the same time as `categorization_analyzer`.
  100. If you only want to define simple regular expression filters that are applied
  101. prior to tokenization, setting this property is the easiest method.
  102. If you also want to customize the tokenizer or post-tokenization filtering,
  103. use the `categorization_analyzer` property instead and include the filters as
  104. `pattern_replace` character filters. The effect is exactly the same.
  105. `categorization_analyzer`::
  106. (object or string) If `categorization_field_name` is specified, you can also
  107. define the analyzer that is used to interpret the categorization field. This
  108. property cannot be used at the same time as `categorization_filters`. See
  109. <<ml-categorizationanalyzer,categorization analyzer>>.
  110. `detectors`::
  111. (array) An array of detector configuration objects,
  112. which describe the anomaly detectors that are used in the job.
  113. See <<ml-detectorconfig,detector configuration objects>>. +
  114. +
  115. --
  116. NOTE: If the `detectors` array does not contain at least one detector,
  117. no analysis can occur and an error is returned.
  118. --
  119. `influencers`::
  120. (array of strings) A comma separated list of influencer field names.
  121. Typically these can be the by, over, or partition fields that are used in the
  122. detector configuration. You might also want to use a field name that is not
  123. specifically named in a detector, but is available as part of the input data.
  124. When you use multiple detectors, the use of influencers is recommended as it
  125. aggregates results for each influencer entity.
  126. `latency`::
  127. (time units) The size of the window in which to expect data that is out of
  128. time order. The default value is 0 (no latency). If you specify a non-zero
  129. value, it must be greater than or equal to one second. For more information
  130. about time units, see <<time-units,Common options>>.
  131. +
  132. --
  133. NOTE: Latency is only applicable when you send data by using
  134. the <<ml-post-data,post data>> API.
  135. --
  136. `multivariate_by_fields`::
  137. (boolean) This functionality is reserved for internal use. It is not supported
  138. for use in customer environments and is not subject to the support SLA of
  139. official GA features.
  140. +
  141. --
  142. If set to `true`, the analysis will automatically find correlations
  143. between metrics for a given `by` field value and report anomalies when those
  144. correlations cease to hold. For example, suppose CPU and memory usage on host A
  145. is usually highly correlated with the same metrics on host B. Perhaps this
  146. correlation occurs because they are running a load-balanced application.
  147. If you enable this property, then anomalies will be reported when, for example,
  148. CPU usage on host A is high and the value of CPU usage on host B is low.
  149. That is to say, you'll see an anomaly when the CPU of host A is unusual given
  150. the CPU of host B.
  151. NOTE: To use the `multivariate_by_fields` property, you must also specify
  152. `by_field_name` in your detector.
  153. --
  154. `summary_count_field_name`::
  155. (string) If this property is specified, the data that is fed to the job is
  156. expected to be pre-summarized. This property value is the name of the field
  157. that contains the count of raw data points that have been summarized. The same
  158. `summary_count_field_name` applies to all detectors in the job.
  159. +
  160. --
  161. NOTE: The `summary_count_field_name` property cannot be used with the `metric`
  162. function.
  163. --
  164. After you create a job, you cannot change the analysis configuration object; all
  165. the properties are informational.
  166. [float]
  167. [[ml-detectorconfig]]
  168. ==== Detector Configuration Objects
  169. Detector configuration objects specify which data fields a job analyzes.
  170. They also specify which analytical functions are used.
  171. You can specify multiple detectors for a job.
  172. Each detector has the following properties:
  173. `by_field_name`::
  174. (string) The field used to split the data.
  175. In particular, this property is used for analyzing the splits with respect to their own history.
  176. It is used for finding unusual values in the context of the split.
  177. `detector_description`::
  178. (string) A description of the detector. For example, `Low event rate`.
  179. `detector_index`::
  180. (integer) A unique identifier for the detector. This identifier is based on
  181. the order of the detectors in the `analysis_config`, starting at zero. You can
  182. use this identifier when you want to update a specific detector.
  183. `exclude_frequent`::
  184. (string) Contains one of the following values: `all`, `none`, `by`, or `over`.
  185. If set, frequent entities are excluded from influencing the anomaly results.
  186. Entities can be considered frequent over time or frequent in a population.
  187. If you are working with both over and by fields, then you can set `exclude_frequent`
  188. to `all` for both fields, or to `by` or `over` for those specific fields.
  189. `field_name`::
  190. (string) The field that the detector uses in the function. If you use an event rate
  191. function such as `count` or `rare`, do not specify this field. +
  192. +
  193. --
  194. NOTE: The `field_name` cannot contain double quotes or backslashes.
  195. --
  196. `function`::
  197. (string) The analysis function that is used.
  198. For example, `count`, `rare`, `mean`, `min`, `max`, and `sum`. For more
  199. information, see {xpack-ref}/ml-functions.html[Function Reference].
  200. `over_field_name`::
  201. (string) The field used to split the data.
  202. In particular, this property is used for analyzing the splits with respect to
  203. the history of all splits. It is used for finding unusual values in the
  204. population of all splits. For more information, see
  205. {xpack-ref}/ml-configuring-pop.html[Performing Population Analysis].
  206. `partition_field_name`::
  207. (string) The field used to segment the analysis.
  208. When you use this property, you have completely independent baselines for each value of this field.
  209. `use_null`::
  210. (boolean) Defines whether a new series is used as the null series
  211. when there is no value for the by or partition fields. The default value is `false`.
  212. `custom_rules`::
  213. (array) An array of custom rule objects, which enable customizing how the detector works.
  214. For example, a rule may dictate to the detector conditions under which results should be skipped.
  215. For more information see <<ml-detector-custom-rule,detector custom rule objects>>. +
  216. +
  217. --
  218. IMPORTANT: Field names are case sensitive, for example a field named 'Bytes'
  219. is different from one named 'bytes'.
  220. --
  221. After you create a job, the only properties you can change in the detector
  222. configuration object are the `detector_description` and the `custom_rules`;
  223. all other properties are informational.
  224. [float]
  225. [[ml-datadescription]]
  226. ==== Data Description Objects
  227. The data description defines the format of the input data when you send data to
  228. the job by using the <<ml-post-data,post data>> API. Note that when configure
  229. a {dfeed}, these properties are automatically set.
  230. When data is received via the <<ml-post-data,post data>> API, it is not stored
  231. in {es}. Only the results for anomaly detection are retained.
  232. A data description object has the following properties:
  233. `format`::
  234. (string) Only `JSON` format is supported at this time.
  235. `time_field`::
  236. (string) The name of the field that contains the timestamp.
  237. The default value is `time`.
  238. `time_format`::
  239. (string) The time format, which can be `epoch`, `epoch_ms`, or a custom pattern.
  240. The default value is `epoch`, which refers to UNIX or Epoch time (the number of seconds
  241. since 1 Jan 1970).
  242. The value `epoch_ms` indicates that time is measured in milliseconds since the epoch.
  243. The `epoch` and `epoch_ms` time formats accept either integer or real values. +
  244. +
  245. --
  246. NOTE: Custom patterns must conform to the Java `DateTimeFormatter` class.
  247. When you use date-time formatting patterns, it is recommended that you provide
  248. the full date, time and time zone. For example: `yyyy-MM-dd'T'HH:mm:ssX`.
  249. If the pattern that you specify is not sufficient to produce a complete timestamp,
  250. job creation fails.
  251. --
  252. [float]
  253. [[ml-categorizationanalyzer]]
  254. ==== Categorization Analyzer
  255. The categorization analyzer specifies how the `categorization_field` is
  256. interpreted by the categorization process. The syntax is very similar to that
  257. used to define the `analyzer` in the <<indices-analyze,Analyze endpoint>>.
  258. The `categorization_analyzer` field can be specified either as a string or as
  259. an object.
  260. If it is a string it must refer to a <<analysis-analyzers,built-in analyzer>> or
  261. one added by another plugin.
  262. If it is an object it has the following properties:
  263. `char_filter`::
  264. (array of strings or objects) One or more
  265. <<analysis-charfilters,character filters>>. In addition to the built-in
  266. character filters, other plugins can provide more character filters. This
  267. property is optional. If it is not specified, no character filters are applied
  268. prior to categorization. If you are customizing some other aspect of the
  269. analyzer and you need to achieve the equivalent of `categorization_filters`
  270. (which are not permitted when some other aspect of the analyzer is customized),
  271. add them here as
  272. <<analysis-pattern-replace-charfilter,pattern replace character filters>>.
  273. `tokenizer`::
  274. (string or object) The name or definition of the
  275. <<analysis-tokenizers,tokenizer>> to use after character filters are applied.
  276. This property is compulsory if `categorization_analyzer` is specified as an
  277. object. Machine learning provides a tokenizer called `ml_classic` that
  278. tokenizes in the same way as the non-customizable tokenizer in older versions
  279. of the product. If you want to use that tokenizer but change the character or
  280. token filters, specify `"tokenizer": "ml_classic"` in your
  281. `categorization_analyzer`.
  282. `filter`::
  283. (array of strings or objects) One or more
  284. <<analysis-tokenfilters,token filters>>. In addition to the built-in token
  285. filters, other plugins can provide more token filters. This property is
  286. optional. If it is not specified, no token filters are applied prior to
  287. categorization.
  288. If you omit the `categorization_analyzer`, the following default values are used:
  289. [source,js]
  290. --------------------------------------------------
  291. POST _ml/anomaly_detectors/_validate
  292. {
  293. "analysis_config" : {
  294. "categorization_analyzer" : {
  295. "tokenizer" : "ml_classic",
  296. "filter" : [
  297. { "type" : "stop", "stopwords": [
  298. "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday",
  299. "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
  300. "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December",
  301. "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
  302. "GMT", "UTC"
  303. ] }
  304. ]
  305. },
  306. "categorization_field_name": "message",
  307. "detectors" :[{
  308. "function":"count",
  309. "by_field_name": "mlcategory"
  310. }]
  311. },
  312. "data_description" : {
  313. }
  314. }
  315. --------------------------------------------------
  316. // CONSOLE
  317. If you specify any part of the `categorization_analyzer`, however, any omitted
  318. sub-properties are _not_ set to default values.
  319. If you are categorizing non-English messages in a language where words are
  320. separated by spaces, you might get better results if you change the day or month
  321. words in the stop token filter to the appropriate words in your language. If you
  322. are categorizing messages in a language where words are not separated by spaces,
  323. you must use a different tokenizer as well in order to get sensible
  324. categorization results.
  325. It is important to be aware that analyzing for categorization of machine
  326. generated log messages is a little different from tokenizing for search.
  327. Features that work well for search, such as stemming, synonym substitution, and
  328. lowercasing are likely to make the results of categorization worse. However, in
  329. order for drill down from {ml} results to work correctly, the tokens that the
  330. categorization analyzer produces must be similar to those produced by the search
  331. analyzer. If they are sufficiently similar, when you search for the tokens that
  332. the categorization analyzer produces then you find the original document that
  333. the categorization field value came from.
  334. For more information, see
  335. {xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
  336. [float]
  337. [[ml-detector-custom-rule]]
  338. ==== Detector Custom Rule
  339. {stack-ov}/ml-rules.html[Custom rules] enable you to customize the way detectors
  340. operate.
  341. A custom rule has the following properties:
  342. `actions`::
  343. (array) The set of actions to be triggered when the rule applies.
  344. If more than one action is specified the effects of all actions are combined.
  345. The available actions include: +
  346. `skip_result`::: The result will not be created. This is the default value.
  347. Unless you also specify `skip_model_update`, the model will be updated as
  348. usual with the corresponding series value.
  349. `skip_model_update`::: The value for that series will not be used to update
  350. the model. Unless you also specify `skip_result`, the results will be created
  351. as usual. This action is suitable when certain values are expected to be
  352. consistently anomalous and they affect the model in a way that negatively
  353. impacts the rest of the results.
  354. `scope`::
  355. (object) An optional scope of series where the rule applies. By default, the
  356. scope includes all series. Scoping is allowed for any of the fields that are
  357. also specified in `by_field_name`, `over_field_name`, or `partition_field_name`.
  358. To add a scope for a field, add the field name as a key in the scope object and
  359. set its value to an object with the following properties:
  360. `filter_id`:::
  361. (string) The id of the filter to be used.
  362. `filter_type`:::
  363. (string) Either `include` (the rule applies for values in the filter)
  364. or `exclude` (the rule applies for values not in the filter). Defaults
  365. to `include`.
  366. `conditions`::
  367. (array) An optional array of numeric conditions when the rule applies.
  368. Multiple conditions are combined together with a logical `AND`.
  369. +
  370. --
  371. NOTE: If your detector uses `lat_long`, `metric`, `rare`, or `freq_rare`
  372. functions, you can only specify `conditions` that apply to `time`.
  373. A condition has the following properties:
  374. `applies_to`:::
  375. (string) Specifies the result property to which the condition applies.
  376. The available options are `actual`, `typical`, `diff_from_typical`, `time`.
  377. `operator`:::
  378. (string) Specifies the condition operator. The available options are
  379. `gt` (greater than), `gte` (greater than or equals), `lt` (less than) and `lte` (less than or equals).
  380. `value`:::
  381. (double) The value that is compared against the `applies_to` field using the `operator`.
  382. --
  383. A rule is required to either have a non-empty scope or at least one condition.
  384. For more examples see
  385. {stack-ov}/ml-configuring-detector-custom-rules.html[Configuring Detector Custom Rules].
  386. [float]
  387. [[ml-apilimits]]
  388. ==== Analysis Limits
  389. Limits can be applied for the resources required to hold the mathematical models in memory.
  390. These limits are approximate and can be set per job. They do not control the
  391. memory used by other processes, for example the Elasticsearch Java processes.
  392. If necessary, you can increase the limits after the job is created.
  393. The `analysis_limits` object has the following properties:
  394. `categorization_examples_limit`::
  395. (long) The maximum number of examples stored per category in memory and
  396. in the results data store. The default value is 4. If you increase this value,
  397. more examples are available, however it requires that you have more storage available.
  398. If you set this value to `0`, no examples are stored. +
  399. +
  400. --
  401. NOTE: The `categorization_examples_limit` only applies to analysis that uses categorization.
  402. For more information, see
  403. {xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
  404. --
  405. `model_memory_limit`::
  406. (long or string) The approximate maximum amount of memory resources that are
  407. required for analytical processing. Once this limit is approached, data pruning
  408. becomes more aggressive. Upon exceeding this limit, new entities are not
  409. modeled. The default value for jobs created in version 6.1 and later is `1024mb`.
  410. This value will need to be increased for jobs that are expected to analyze high
  411. cardinality fields, but the default is set to a relatively small size to ensure
  412. that high resource usage is a conscious decision. The default value for jobs
  413. created in versions earlier than 6.1 is `4096mb`.
  414. +
  415. --
  416. If you specify a number instead of a string, the units are assumed to be MiB.
  417. Specifying a string is recommended for clarity. If you specify a byte size unit
  418. of `b` or `kb` and the number does not equate to a discrete number of megabytes,
  419. it is rounded down to the closest MiB. The minimum valid value is 1 MiB. If you
  420. specify a value less than 1 MiB, an error occurs. For more information about
  421. supported byte size units, see <<byte-units,Common options>>.
  422. If your `elasticsearch.yml` file contains an `xpack.ml.max_model_memory_limit`
  423. setting, an error occurs when you try to create jobs that have
  424. `model_memory_limit` values greater than that setting. For more information,
  425. see <<ml-settings>>.
  426. --
  427. [float]
  428. [[ml-apimodelplotconfig]]
  429. ==== Model Plot Config
  430. This advanced configuration option stores model information along with the
  431. results. It provides a more detailed view into anomaly detection.
  432. WARNING: If you enable model plot it can add considerable overhead to the performance
  433. of the system; it is not feasible for jobs with many entities.
  434. Model plot provides a simplified and indicative view of the model and its bounds.
  435. It does not display complex features such as multivariate correlations or multimodal data.
  436. As such, anomalies may occasionally be reported which cannot be seen in the model plot.
  437. Model plot config can be configured when the job is created or updated later. It must be
  438. disabled if performance issues are experienced.
  439. The `model_plot_config` object has the following properties:
  440. `enabled`::
  441. (boolean) If true, enables calculation and storage of the model bounds for
  442. each entity that is being analyzed. By default, this is not enabled.
  443. `terms`::
  444. experimental[] (string) Limits data collection to this comma separated list of
  445. partition or by field values. If terms are not specified or it is an empty
  446. string, no filtering is applied. For example, "CPU,NetworkIn,DiskWrites".
  447. Wildcards are not supported. Only the specified `terms` can be viewed when
  448. using the Single Metric Viewer.