2018-06-19 16:57:10 -04:00
|
|
|
|
[role="xpack"]
|
2017-05-05 13:40:17 -04:00
|
|
|
|
[[ml-sum-functions]]
|
2018-06-19 16:57:10 -04:00
|
|
|
|
=== Sum functions
|
2017-05-05 13:40:17 -04:00
|
|
|
|
|
2019-07-26 14:07:01 -04:00
|
|
|
|
The sum functions detect anomalies when the sum of a field in a bucket is
|
|
|
|
|
anomalous.
|
2017-05-05 13:40:17 -04:00
|
|
|
|
|
2017-05-16 10:59:53 -04:00
|
|
|
|
If you want to monitor unusually high totals, use high-sided functions.
|
2017-05-05 13:40:17 -04:00
|
|
|
|
|
2017-05-16 10:59:53 -04:00
|
|
|
|
If want to look at drops in totals, use low-sided functions.
|
2017-05-05 13:40:17 -04:00
|
|
|
|
|
2017-05-16 10:59:53 -04:00
|
|
|
|
If your data is sparse, use `non_null_sum` functions. Buckets without values are
|
|
|
|
|
ignored; buckets with a zero value are analyzed.
|
2017-05-05 13:40:17 -04:00
|
|
|
|
|
2019-01-07 17:32:36 -05:00
|
|
|
|
The {ml-features} include the following sum functions:
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
2017-05-19 13:48:15 -04:00
|
|
|
|
* xref:ml-sum[`sum`, `high_sum`, `low_sum`]
|
|
|
|
|
* xref:ml-nonnull-sum[`non_null_sum`, `high_non_null_sum`, `low_non_null_sum`]
|
2017-05-05 13:40:17 -04:00
|
|
|
|
|
2017-05-16 10:59:53 -04:00
|
|
|
|
[float]
|
|
|
|
|
[[ml-sum]]
|
2018-06-19 16:57:10 -04:00
|
|
|
|
==== Sum, high_sum, low_sum
|
2017-05-05 14:57:20 -04:00
|
|
|
|
|
2017-05-16 10:59:53 -04:00
|
|
|
|
The `sum` function detects anomalies where the sum of a field in a bucket is
|
|
|
|
|
anomalous.
|
|
|
|
|
|
2017-05-19 13:48:15 -04:00
|
|
|
|
If you want to monitor unusually high sum values, use the `high_sum` function.
|
|
|
|
|
|
|
|
|
|
If you want to monitor unusually low sum values, use the `low_sum` function.
|
|
|
|
|
|
|
|
|
|
These functions support the following properties:
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
|
|
|
|
* `field_name` (required)
|
|
|
|
|
* `by_field_name` (optional)
|
|
|
|
|
* `over_field_name` (optional)
|
|
|
|
|
* `partition_field_name` (optional)
|
|
|
|
|
|
2019-12-27 16:30:26 -05:00
|
|
|
|
For more information about those properties, see the
|
|
|
|
|
{ref}/ml-put-job.html#ml-put-job-request-body[create {anomaly-jobs} API].
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
2017-05-19 13:48:15 -04:00
|
|
|
|
.Example 1: Analyzing total expenses with the sum function
|
2017-05-05 14:57:20 -04:00
|
|
|
|
[source,js]
|
|
|
|
|
--------------------------------------------------
|
2017-05-16 10:59:53 -04:00
|
|
|
|
{
|
|
|
|
|
"function" : "sum",
|
|
|
|
|
"field_name" : "expenses",
|
|
|
|
|
"by_field_name" : "costcenter",
|
|
|
|
|
"over_field_name" : "employee"
|
|
|
|
|
}
|
2017-05-05 14:57:20 -04:00
|
|
|
|
--------------------------------------------------
|
2018-06-19 16:57:10 -04:00
|
|
|
|
// NOTCONSOLE
|
2017-05-05 14:57:20 -04:00
|
|
|
|
|
2019-07-26 14:07:01 -04:00
|
|
|
|
If you use this `sum` function in a detector in your {anomaly-job}, it
|
2017-05-19 13:48:15 -04:00
|
|
|
|
models total expenses per employees for each cost center. For each time bucket,
|
|
|
|
|
it detects when an employee’s expenses are unusual for a cost center compared
|
|
|
|
|
to other employees.
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
2017-05-19 13:48:15 -04:00
|
|
|
|
.Example 2: Analyzing total bytes with the high_sum function
|
2017-05-16 10:59:53 -04:00
|
|
|
|
[source,js]
|
|
|
|
|
--------------------------------------------------
|
|
|
|
|
{
|
|
|
|
|
"function" : "high_sum",
|
|
|
|
|
"field_name" : "cs_bytes",
|
|
|
|
|
"over_field_name" : "cs_host"
|
|
|
|
|
}
|
|
|
|
|
--------------------------------------------------
|
2018-06-19 16:57:10 -04:00
|
|
|
|
// NOTCONSOLE
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
2019-07-26 14:07:01 -04:00
|
|
|
|
If you use this `high_sum` function in a detector in your {anomaly-job}, it
|
2017-05-19 13:48:15 -04:00
|
|
|
|
models total `cs_bytes`. It detects `cs_hosts` that transfer unusually high
|
|
|
|
|
volumes compared to other `cs_hosts`. This example looks for volumes of data
|
|
|
|
|
transferred from a client to a server on the internet that are unusual compared
|
|
|
|
|
to other clients. This scenario could be useful to detect data exfiltration or
|
|
|
|
|
to find users that are abusing internet privileges.
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
|
|
|
|
[float]
|
|
|
|
|
[[ml-nonnull-sum]]
|
2018-06-19 16:57:10 -04:00
|
|
|
|
==== Non_null_sum, high_non_null_sum, low_non_null_sum
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
|
|
|
|
The `non_null_sum` function is useful if your data is sparse. Buckets without
|
|
|
|
|
values are ignored and buckets with a zero value are analyzed.
|
|
|
|
|
|
2017-05-19 13:48:15 -04:00
|
|
|
|
If you want to monitor unusually high totals, use the `high_non_null_sum`
|
|
|
|
|
function.
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
2017-05-19 13:48:15 -04:00
|
|
|
|
If you want to look at drops in totals, use the `low_non_null_sum` function.
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
2017-05-19 13:48:15 -04:00
|
|
|
|
These functions support the following properties:
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
|
|
|
|
* `field_name` (required)
|
|
|
|
|
* `by_field_name` (optional)
|
|
|
|
|
* `partition_field_name` (optional)
|
|
|
|
|
|
2019-12-27 16:30:26 -05:00
|
|
|
|
For more information about those properties, see the
|
|
|
|
|
{ref}/ml-put-job.html#ml-put-job-request-body[create {anomaly-jobs} API].
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
|
|
|
|
NOTE: Population analysis (that is to say, use of the `over_field_name` property)
|
|
|
|
|
is not applicable for this function.
|
|
|
|
|
|
2017-05-19 13:48:15 -04:00
|
|
|
|
.Example 3: Analyzing employee approvals with the high_non_null_sum function
|
2017-05-16 10:59:53 -04:00
|
|
|
|
[source,js]
|
|
|
|
|
--------------------------------------------------
|
|
|
|
|
{
|
|
|
|
|
"function" : "high_non_null_sum",
|
|
|
|
|
"fieldName" : "amount_approved",
|
|
|
|
|
"byFieldName" : "employee"
|
|
|
|
|
}
|
|
|
|
|
--------------------------------------------------
|
2018-06-19 16:57:10 -04:00
|
|
|
|
// NOTCONSOLE
|
2017-05-16 10:59:53 -04:00
|
|
|
|
|
2019-07-26 14:07:01 -04:00
|
|
|
|
If you use this `high_non_null_sum` function in a detector in your {anomaly-job},
|
|
|
|
|
it models the total `amount_approved` for each employee. It ignores any buckets
|
2017-05-19 13:48:15 -04:00
|
|
|
|
where the amount is null. It detects employees who approve unusually high
|
|
|
|
|
amounts compared to their past behavior.
|