Skip to content

Commit fc997b9

Browse files
authored
[Logs UI] Create ML module for log analysis (#42872) (#43261)
* Add ml module with hard-coded timestamp field * Fix data_recognizer test * Parameterize the bucket span normalization * Remove max agg which will be specified during setup The overrides are recursively merged and therefore additive. Therefore we can't specify the timestamp agg here, because it could not be overridden later with a different field and agg name. It needs to be solely specified at setup time.
1 parent a1359a2 commit fc997b9

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

x-pack/legacy/plugins/ml/server/models/data_recognizer/__tests__/data_recognizer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe('ML - data recognizer', () => {
1717
'apm_transaction',
1818
'auditbeat_process_docker_ecs',
1919
'auditbeat_process_hosts_ecs',
20+
'logs_ui_analysis',
2021
'metricbeat_system_ecs',
2122
'nginx_ecs',
2223
'sample_data_ecommerce',
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"icon": "loggingApp"
3+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"id": "logs_ui_analysis",
3+
"title": "Log Analysis",
4+
"description": "Detect anomalies in log entries via the Logs UI",
5+
"type": "Logs",
6+
"logoFile": "logo.json",
7+
"jobs": [
8+
{
9+
"id": "log-entry-rate",
10+
"file": "log_entry_rate.json"
11+
}
12+
],
13+
"datafeeds": [
14+
{
15+
"id": "datafeed-log-entry-rate",
16+
"file": "datafeed_log_entry_rate.json",
17+
"job_id": "log-entry-rate"
18+
}
19+
]
20+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"job_id": "JOB_ID",
3+
"indexes": ["INDEX_PATTERN_NAME"],
4+
"aggregations": {
5+
"buckets": {
6+
"date_histogram": {
7+
"field": "@timestamp",
8+
"fixed_interval": "900000ms"
9+
},
10+
"aggregations": {
11+
"doc_count_per_minute": {
12+
"bucket_script": {
13+
"buckets_path": {
14+
"doc_count": "_count"
15+
},
16+
"script": {
17+
"lang": "painless",
18+
"params": {
19+
"bucket_span_in_ms": 900000
20+
},
21+
"source": "60 * 1000 * params.doc_count / params.bucket_span_in_ms"
22+
}
23+
}
24+
}
25+
}
26+
}
27+
}
28+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"job_type": "anomaly_detector",
3+
"description": "Detect anomalies in the log entry ingestion rate",
4+
"groups": ["logs-ui"],
5+
"analysis_config": {
6+
"bucket_span": "15m",
7+
"summary_count_field_name": "doc_count_per_minute",
8+
"detectors": [
9+
{
10+
"detector_description": "count",
11+
"function": "count",
12+
"detector_index": 0
13+
}
14+
],
15+
"influencers": []
16+
},
17+
"analysis_limits": {
18+
"model_memory_limit": "10mb"
19+
},
20+
"data_description": {
21+
"time_field": "@timestamp",
22+
"time_format": "epoch_ms"
23+
},
24+
"model_plot_config": {
25+
"enabled": true
26+
},
27+
"custom_settings": {
28+
"created_by": "ml-module-logs-ui-analysis"
29+
}
30+
}

0 commit comments

Comments
 (0)