From 1bffd227351d83b65e2b1b377c2680f71d1a7e5d Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 6 Dec 2021 13:10:34 +0100 Subject: [PATCH 1/2] Commented hostname-tag as it could be misleading --- src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index 66cff1f..e41f35e 100644 --- a/src/main.js +++ b/src/main.js @@ -60,7 +60,7 @@ if(errorMsg){ logger.debug("Get WriteApi & set default-hostname to", `'${env.HOSTNAME}'`); const influxWriteApi = influxDb.getWriteApi(env.INFLUX_ORG, env.INFLUX_BUCKET, "us"); - influxWriteApi.useDefaultTags({"hostname": env.HOSTNAME}); + //influxWriteApi.useDefaultTags({"hostname": env.HOSTNAME}); logger.info("Influx ok"); logger.info("Starting tcpdump.."); From 94846a48e1f8ec279e71aebc12ff0a2afdf8d776 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 6 Dec 2021 13:32:21 +0100 Subject: [PATCH 2/2] Fix data-fields not getting added as tags --- src/streamHandler/PacketInfluxPointFactory.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/streamHandler/PacketInfluxPointFactory.js b/src/streamHandler/PacketInfluxPointFactory.js index 764cd3b..f4171d2 100644 --- a/src/streamHandler/PacketInfluxPointFactory.js +++ b/src/streamHandler/PacketInfluxPointFactory.js @@ -4,12 +4,12 @@ const {Point} = require("@influxdata/influxdb-client"); /** Keys to always use as tags */ const TAG_LIST = [ - "srcmac", - "dstmac", + "srcMac", + "dstMac", "bssid", "frequency", "flags", - "packettype", + "packetType", ]; /** Measurement-name and corresponding field-key */ @@ -66,7 +66,10 @@ function tagObjectRecursively(point, tag, field, suffix = ""){ tagObjectRecursively(point, tag, value, `_${key}${suffix}`); }); } - else point.tag(tag+suffix, field); + else { + const name = (tag+suffix).toLowerCase(); + point.tag(name, field); + } } /** Mapping for type -> field-method */