From 5763e3abab22aab55639181776c6d4fe1bb32045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20=C3=81ngel=20Gonz=C3=A1lez?= Date: Tue, 17 Apr 2018 09:21:49 +0200 Subject: [PATCH] Adding cluster object to documents from monitoring index. closes #375 --- server/monitoring.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/monitoring.js b/server/monitoring.js index 55e16621b..73c603027 100644 --- a/server/monitoring.js +++ b/server/monitoring.js @@ -208,12 +208,12 @@ module.exports = (server, options) => { let body = ''; if (agentsArray.length > 0) { let managerName = agentsArray[0].name; - for(let element of agentsArray) { body += '{ "index": { "_index": "' + todayIndex + '", "_type": "wazuh-agent" } }\n'; let date = new Date(Date.now()).toISOString(); - element["@timestamp"] = date; - element["host"] = managerName; + element['@timestamp'] = date; + element.host = managerName; + element.cluster = { name: element.cluster && element.cluster.name ? element.cluster.name : 'disabled' } ; body += JSON.stringify(element) + "\n"; } if (body === '') return;