From 51b64b3f5d577815a2dd83c396b1385f095f32bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Wed, 23 Oct 2024 06:09:56 +0000 Subject: [PATCH 1/6] fix(config): Add missing property in sample config file Fixes #930 --- src/config/production_template.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/config/production_template.yaml b/src/config/production_template.yaml index 8bfdaa6c..3a20562b 100644 --- a/src/config/production_template.yaml +++ b/src/config/production_template.yaml @@ -163,6 +163,8 @@ Butler-SOS: enable: false # Should log events from the repository service be handled? scheduler: enable: false # Should log events from the scheduler service be handled? + qixPerf: + enable: true # Should log events relating to QIX performance be handled? categorise: # Take actions on log events based on their content enable: false rules: # Rules are used to match log events to filters From 45733c93131aaec4191f10a10ac12d0385ea5dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Wed, 23 Oct 2024 06:13:57 +0000 Subject: [PATCH 2/6] fix(startup): Make sure log level can be set via command line Fixes #932 --- src/butler-sos.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/butler-sos.js b/src/butler-sos.js index bbb60f32..1df2e38e 100755 --- a/src/butler-sos.js +++ b/src/butler-sos.js @@ -54,6 +54,9 @@ async function sleep(ms) { } async function mainScript() { + // Set env variable to indicate that it is ok to change config settings + process.env.ALLOW_CONFIG_MUTATIONS = 'true'; + // Load globals dynamically/async to ensure singleton pattern works const settingsObj = (await import('./globals.js')).default; const globals = await settingsObj.init(); From 4010a1c6c2bd2e98eaa5182b342b16225b76b18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Wed, 23 Oct 2024 06:40:46 +0000 Subject: [PATCH 3/6] fix(startup): Make sure no attempts to access InfluxDB if it is disabled in config file Fixes #931 --- src/globals.js | 15 +++++---------- src/lib/udp-event.js | 7 +++++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/globals.js b/src/globals.js index 31df1b82..cd8e6a6a 100755 --- a/src/globals.js +++ b/src/globals.js @@ -659,14 +659,6 @@ class Settings { }, tags: tagValuesUserProxySessions, }, - // { - // measurement: 'user_events', - // fields: { - // userFull: Influx.FieldType.STRING, - // userId: Influx.FieldType.STRING - // }, - // tags: ['host', 'event_action', 'userFull', 'userDirectory', 'userId', 'origin'] - // }, ], }); } else if (this.config.get('Butler-SOS.influxdbConfig.version') === 2) { @@ -687,10 +679,13 @@ class Settings { `CONFIG: Influxdb version ${this.config.get('Butler-SOS.influxdbConfig.version')} is not supported!` ); } + + // Now initialise InfluxDB + await this.initInfluxDB(); + } else { + this.logger.info(`CONFIG: Influxdb not enabled, skipping setup of db.`); } - // Now initialise InfluxDB - await this.initInfluxDB(); // ------------------------------------ // Create MQTT client object and connect to MQTT broker diff --git a/src/lib/udp-event.js b/src/lib/udp-event.js index d5eddfe2..c5480ca2 100644 --- a/src/lib/udp-event.js +++ b/src/lib/udp-event.js @@ -287,8 +287,11 @@ export class UdpEvents { export function setupUdpEventsStorage() { // Is storing event counts to InfluxDB enabled? - if (globals.config.get('Butler-SOS.qlikSenseEvents.influxdb.enable') !== true) { - globals.logger.verbose( + if ( + globals.config.get('Butler-SOS.influxdbConfig.enable') !== true || + globals.config.get('Butler-SOS.qlikSenseEvents.influxdb.enable') !== true + ) { + globals.logger.info( 'EVENT COUNTS: Feature is disabled in config file. Skipping setup of timer for storing event counts to InfluxDB' ); return; From 9601a9caa9cce0c8a0a8752579f1751b841a0a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Wed, 23 Oct 2024 06:43:41 +0000 Subject: [PATCH 4/6] fix(config): Allow empty New Relic destination array in config file Fixes #929 --- src/lib/config-file-schema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/config-file-schema.js b/src/lib/config-file-schema.js index 626a00f9..44135feb 100755 --- a/src/lib/config-file-schema.js +++ b/src/lib/config-file-schema.js @@ -72,7 +72,7 @@ export const confifgFileSchema = { properties: { enable: { type: 'boolean' }, destinationAccount: { - type: 'array', + type: ['array', 'null'], minItems: 0, items: { type: 'string', From a904cd499e1f9684cb74b08941ee2d8cc9fe10fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Wed, 23 Oct 2024 06:45:18 +0000 Subject: [PATCH 5/6] Source code formatting --- src/globals.js | 1 - src/lib/post-to-influxdb.js | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/globals.js b/src/globals.js index cd8e6a6a..93445f57 100755 --- a/src/globals.js +++ b/src/globals.js @@ -686,7 +686,6 @@ class Settings { this.logger.info(`CONFIG: Influxdb not enabled, skipping setup of db.`); } - // ------------------------------------ // Create MQTT client object and connect to MQTT broker // Only do this if MQTT is enabled diff --git a/src/lib/post-to-influxdb.js b/src/lib/post-to-influxdb.js index 3937a6ef..791569cc 100755 --- a/src/lib/post-to-influxdb.js +++ b/src/lib/post-to-influxdb.js @@ -1000,9 +1000,13 @@ export async function postLogEventToInfluxdb(msg) { subsystem: msg.subsystem?.length > 0 ? msg.subsystem : '', method: msg.method?.length > 0 ? msg.method : '', object_type: msg.object_type?.length > 0 ? msg.object_type : '', - proxy_session_id: msg.proxy_session_id?.length > 0 ? msg.proxy_session_id : '-1', + proxy_session_id: + msg.proxy_session_id?.length > 0 ? msg.proxy_session_id : '-1', session_id: msg.session_id?.length > 0 ? msg.session_id : '-1', - event_activity_source: msg.event_activity_source?.length > 0 ? msg.event_activity_source : '', + event_activity_source: + msg.event_activity_source?.length > 0 + ? msg.event_activity_source + : '', }; // Tags that are empty in some cases. Only add if they are non-empty From f9d8ecb66f2ae51a63bfc1a340171efef3ab3e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Sander?= Date: Wed, 23 Oct 2024 07:31:43 +0000 Subject: [PATCH 6/6] fix(influxdb2): Allow pos/neg engine cache values Fixes #933 --- src/lib/post-to-influxdb.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/post-to-influxdb.js b/src/lib/post-to-influxdb.js index 791569cc..cb219370 100755 --- a/src/lib/post-to-influxdb.js +++ b/src/lib/post-to-influxdb.js @@ -454,9 +454,9 @@ export async function postHealthMetricsToInfluxdb(serverName, host, body, server new Point('cache') .uintField('hits', body.cache.hits) .uintField('lookups', body.cache.lookups) - .uintField('added', body.cache.added) - .uintField('replaced', body.cache.replaced) - .uintField('bytes_added', body.cache.bytes_added), + .intField('added', body.cache.added) + .intField('replaced', body.cache.replaced) + .intField('bytes_added', body.cache.bytes_added), new Point('saturated').booleanField('saturated', body.saturated), ];