sum.asciidoc 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. [role="xpack"]
  2. [[ml-sum-functions]]
  3. === Sum functions
  4. The sum functions detect anomalies when the sum of a field in a bucket is anomalous.
  5. If you want to monitor unusually high totals, use high-sided functions.
  6. If want to look at drops in totals, use low-sided functions.
  7. If your data is sparse, use `non_null_sum` functions. Buckets without values are
  8. ignored; buckets with a zero value are analyzed.
  9. The {xpackml} features include the following sum functions:
  10. * xref:ml-sum[`sum`, `high_sum`, `low_sum`]
  11. * xref:ml-nonnull-sum[`non_null_sum`, `high_non_null_sum`, `low_non_null_sum`]
  12. [float]
  13. [[ml-sum]]
  14. ==== Sum, high_sum, low_sum
  15. The `sum` function detects anomalies where the sum of a field in a bucket is
  16. anomalous.
  17. If you want to monitor unusually high sum values, use the `high_sum` function.
  18. If you want to monitor unusually low sum values, use the `low_sum` function.
  19. These functions support the following properties:
  20. * `field_name` (required)
  21. * `by_field_name` (optional)
  22. * `over_field_name` (optional)
  23. * `partition_field_name` (optional)
  24. For more information about those properties, see
  25. {ref}/ml-job-resource.html#ml-detectorconfig[Detector Configuration Objects].
  26. .Example 1: Analyzing total expenses with the sum function
  27. [source,js]
  28. --------------------------------------------------
  29. {
  30. "function" : "sum",
  31. "field_name" : "expenses",
  32. "by_field_name" : "costcenter",
  33. "over_field_name" : "employee"
  34. }
  35. --------------------------------------------------
  36. // NOTCONSOLE
  37. If you use this `sum` function in a detector in your job, it
  38. models total expenses per employees for each cost center. For each time bucket,
  39. it detects when an employee’s expenses are unusual for a cost center compared
  40. to other employees.
  41. .Example 2: Analyzing total bytes with the high_sum function
  42. [source,js]
  43. --------------------------------------------------
  44. {
  45. "function" : "high_sum",
  46. "field_name" : "cs_bytes",
  47. "over_field_name" : "cs_host"
  48. }
  49. --------------------------------------------------
  50. // NOTCONSOLE
  51. If you use this `high_sum` function in a detector in your job, it
  52. models total `cs_bytes`. It detects `cs_hosts` that transfer unusually high
  53. volumes compared to other `cs_hosts`. This example looks for volumes of data
  54. transferred from a client to a server on the internet that are unusual compared
  55. to other clients. This scenario could be useful to detect data exfiltration or
  56. to find users that are abusing internet privileges.
  57. [float]
  58. [[ml-nonnull-sum]]
  59. ==== Non_null_sum, high_non_null_sum, low_non_null_sum
  60. The `non_null_sum` function is useful if your data is sparse. Buckets without
  61. values are ignored and buckets with a zero value are analyzed.
  62. If you want to monitor unusually high totals, use the `high_non_null_sum`
  63. function.
  64. If you want to look at drops in totals, use the `low_non_null_sum` function.
  65. These functions support the following properties:
  66. * `field_name` (required)
  67. * `by_field_name` (optional)
  68. * `partition_field_name` (optional)
  69. For more information about those properties, see
  70. {ref}/ml-job-resource.html#ml-detectorconfig[Detector Configuration Objects].
  71. NOTE: Population analysis (that is to say, use of the `over_field_name` property)
  72. is not applicable for this function.
  73. .Example 3: Analyzing employee approvals with the high_non_null_sum function
  74. [source,js]
  75. --------------------------------------------------
  76. {
  77. "function" : "high_non_null_sum",
  78. "fieldName" : "amount_approved",
  79. "byFieldName" : "employee"
  80. }
  81. --------------------------------------------------
  82. // NOTCONSOLE
  83. If you use this `high_non_null_sum` function in a detector in your job, it
  84. models the total `amount_approved` for each employee. It ignores any buckets
  85. where the amount is null. It detects employees who approve unusually high
  86. amounts compared to their past behavior.
  87. //For this credit control system analysis, using non_null_sum will ignore
  88. //periods where the employees are not active on the system.