-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…5772) * ingest: introduce apm_data_stream_migration (#5768) (cherry picked from commit 4f4dca2) # Conflicts: # changelogs/head.asciidoc * Delete head.asciidoc Co-authored-by: Andrew Wilkins <axw@elastic.co>
- Loading branch information
1 parent
225929f
commit 526d4ec
Showing
9 changed files
with
294 additions
and
1 deletion.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
.../apm/data_stream/app_metrics/elasticsearch/ingest_pipeline/apm_data_stream_migration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"description": "Migrate APM events to data streams", | ||
"processors": [ | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'span' || ctx.processor?.event == 'transaction'", | ||
"source": "ctx.data_stream = [\"type\": \"traces\", \"dataset\": \"apm\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'error'", | ||
"source": "ctx.data_stream = [\"type\": \"logs\", \"dataset\": \"apm.error\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'metric'", | ||
"source": "String dataset;\nif (ctx[\"metricset.name\"] != \"app\") {\n dataset = \"apm.internal\";\n} else {\n String serviceName = ctx.service.name;\n serviceName = serviceName.toLowerCase();\n serviceName = /[\\\\\\/*?\"<>| ,#:-]/.matcher(serviceName).replaceAll('_');\n dataset = \"apm.app.\" + serviceName;\n}\nctx.data_stream = [\"type\": \"metrics\", \"dataset\": dataset, \"namespace\": \"migrated\"];\n" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"if": "ctx.data_stream != null", | ||
"field": "_index", | ||
"value": "{{data_stream.type}}-{{data_stream.dataset}}-{{data_stream.namespace}}" | ||
} | ||
} | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
...e/apm/data_stream/error_logs/elasticsearch/ingest_pipeline/apm_data_stream_migration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"description": "Migrate APM events to data streams", | ||
"processors": [ | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'span' || ctx.processor?.event == 'transaction'", | ||
"source": "ctx.data_stream = [\"type\": \"traces\", \"dataset\": \"apm\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'error'", | ||
"source": "ctx.data_stream = [\"type\": \"logs\", \"dataset\": \"apm.error\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'metric'", | ||
"source": "String dataset;\nif (ctx[\"metricset.name\"] != \"app\") {\n dataset = \"apm.internal\";\n} else {\n String serviceName = ctx.service.name;\n serviceName = serviceName.toLowerCase();\n serviceName = /[\\\\\\/*?\"<>| ,#:-]/.matcher(serviceName).replaceAll('_');\n dataset = \"apm.app.\" + serviceName;\n}\nctx.data_stream = [\"type\": \"metrics\", \"dataset\": dataset, \"namespace\": \"migrated\"];\n" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"if": "ctx.data_stream != null", | ||
"field": "_index", | ||
"value": "{{data_stream.type}}-{{data_stream.dataset}}-{{data_stream.namespace}}" | ||
} | ||
} | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
...data_stream/internal_metrics/elasticsearch/ingest_pipeline/apm_data_stream_migration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"description": "Migrate APM events to data streams", | ||
"processors": [ | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'span' || ctx.processor?.event == 'transaction'", | ||
"source": "ctx.data_stream = [\"type\": \"traces\", \"dataset\": \"apm\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'error'", | ||
"source": "ctx.data_stream = [\"type\": \"logs\", \"dataset\": \"apm.error\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'metric'", | ||
"source": "String dataset;\nif (ctx[\"metricset.name\"] != \"app\") {\n dataset = \"apm.internal\";\n} else {\n String serviceName = ctx.service.name;\n serviceName = serviceName.toLowerCase();\n serviceName = /[\\\\\\/*?\"<>| ,#:-]/.matcher(serviceName).replaceAll('_');\n dataset = \"apm.app.\" + serviceName;\n}\nctx.data_stream = [\"type\": \"metrics\", \"dataset\": dataset, \"namespace\": \"migrated\"];\n" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"if": "ctx.data_stream != null", | ||
"field": "_index", | ||
"value": "{{data_stream.type}}-{{data_stream.dataset}}-{{data_stream.namespace}}" | ||
} | ||
} | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
.../data_stream/profile_metrics/elasticsearch/ingest_pipeline/apm_data_stream_migration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"description": "Migrate APM events to data streams", | ||
"processors": [ | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'span' || ctx.processor?.event == 'transaction'", | ||
"source": "ctx.data_stream = [\"type\": \"traces\", \"dataset\": \"apm\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'error'", | ||
"source": "ctx.data_stream = [\"type\": \"logs\", \"dataset\": \"apm.error\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'metric'", | ||
"source": "String dataset;\nif (ctx[\"metricset.name\"] != \"app\") {\n dataset = \"apm.internal\";\n} else {\n String serviceName = ctx.service.name;\n serviceName = serviceName.toLowerCase();\n serviceName = /[\\\\\\/*?\"<>| ,#:-]/.matcher(serviceName).replaceAll('_');\n dataset = \"apm.app.\" + serviceName;\n}\nctx.data_stream = [\"type\": \"metrics\", \"dataset\": dataset, \"namespace\": \"migrated\"];\n" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"if": "ctx.data_stream != null", | ||
"field": "_index", | ||
"value": "{{data_stream.type}}-{{data_stream.dataset}}-{{data_stream.namespace}}" | ||
} | ||
} | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
...ckage/apm/data_stream/traces/elasticsearch/ingest_pipeline/apm_data_stream_migration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"description": "Migrate APM events to data streams", | ||
"processors": [ | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'span' || ctx.processor?.event == 'transaction'", | ||
"source": "ctx.data_stream = [\"type\": \"traces\", \"dataset\": \"apm\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'error'", | ||
"source": "ctx.data_stream = [\"type\": \"logs\", \"dataset\": \"apm.error\", \"namespace\": \"migrated\"]\n" | ||
} | ||
}, | ||
{ | ||
"script": { | ||
"if": "ctx.processor?.event == 'metric'", | ||
"source": "String dataset;\nif (ctx[\"metricset.name\"] != \"app\") {\n dataset = \"apm.internal\";\n} else {\n String serviceName = ctx.service.name;\n serviceName = serviceName.toLowerCase();\n serviceName = /[\\\\\\/*?\"<>| ,#:-]/.matcher(serviceName).replaceAll('_');\n dataset = \"apm.app.\" + serviceName;\n}\nctx.data_stream = [\"type\": \"metrics\", \"dataset\": dataset, \"namespace\": \"migrated\"];\n" | ||
} | ||
}, | ||
{ | ||
"set": { | ||
"if": "ctx.data_stream != null", | ||
"field": "_index", | ||
"value": "{{data_stream.type}}-{{data_stream.dataset}}-{{data_stream.namespace}}" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters