jobresource.asciidoc 24 KB

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