From 01500b8a2030333f9739c7f3f5b605574ccab7e8 Mon Sep 17 00:00:00 2001 From: Adnan Rahic Date: Thu, 16 Apr 2020 15:14:24 +0200 Subject: [PATCH] Edited commits field to be array instead of object to avoid 'Too many fields present in the index' issue --- bin/logagent.js | 2 +- lib/plugins/output-filter/github-logs-format.js | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/logagent.js b/bin/logagent.js index 3e6d2340..3b39695b 100755 --- a/bin/logagent.js +++ b/bin/logagent.js @@ -258,7 +258,7 @@ LaCli.prototype.loadPlugins = function (configFile) { { module: '../lib/plugins/input/stdin', config: stdInConfig, globalConfig: configFile }, { module: '../lib/plugins/output/stdout', config: stdOutConfig, globalConfig: configFile } ] - + if (this.argv.k8sEvents) { plugins.push({ module: 'input-kubernetes-events', diff --git a/lib/plugins/output-filter/github-logs-format.js b/lib/plugins/output-filter/github-logs-format.js index 7cbdbb46..f4d67076 100644 --- a/lib/plugins/output-filter/github-logs-format.js +++ b/lib/plugins/output-filter/github-logs-format.js @@ -1,6 +1,11 @@ function formatSematextLogsOutput (context, config, eventEmitter, log, callback) { try { const parsedLog = parseGithubEvent(log) + + if (config.debug) { + console.log(parsedLog) + } + if (parsedLog) { callback(null, parsedLog) } } catch (e) { callback(e, log) @@ -314,14 +319,9 @@ const parsePush = (event, body) => { modified } - acc[id] = currCommit + acc.push(currCommit) return acc - }, {}) - - const parsedCommits = { - count: commitCount, - ...reducedCommits - } + }, []) return { ...initEvent({ event, action, webhookName: 'GitHub' }), @@ -332,7 +332,8 @@ const parsePush = (event, body) => { repository: parsedRepo, sender: parsedSender, headCommit: parsedHeadCommit, - commits: parsedCommits + commitCount, + commits: reducedCommits } }