Skip to content

Instantly share code, notes, and snippets.

@chrisronline
Created July 1, 2020 17:32
Show Gist options
  • Save chrisronline/3b982d95710ef820d11c7443a1e49091 to your computer and use it in GitHub Desktop.
Save chrisronline/3b982d95710ef820d11c7443a1e49091 to your computer and use it in GitHub Desktop.
# LOGSTASH VERSION MISMATCH
PUT _ingest/pipeline/logstash_change_versions
{
"processors": [
{
"script": {
"lang": "painless",
"source": """
if (ctx.type == "logstash_stats") {
String[] versions = new String[] { "7.0.0", "7.1.0", "7.2.0" };
String[] uuids = new String[] { 'abc', 'def', 'ghi' };
int random = new Random().nextInt(versions.length);
String version = versions[random];
String uuid = uuids[random];
ctx.logstash_stats.logstash.version = version;
ctx.logstash_stats.logstash.uuid = uuid;
}
"""
}
}
]
}
# Ensure a local exporter is explictly configured so the default pipeline is established
PUT _cluster/settings
{
"transient": {
"xpack.monitoring.exporters": {
"local": {
"type": "local",
"use_ingest": false
}
}
}
}
# Use the created pipeline
PUT .monitoring-logstash-7-*/_settings
{
"index.default_pipeline": "logstash_change_versions"
}
# This will unset the pipeline (and therefore resolve the alert)
PUT .monitoring-logstash-7-*/_settings
{
"index.default_pipeline": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment