From b5e0508962e0d0c3f8a4462c7a48960f6b8017c8 Mon Sep 17 00:00:00 2001
From: Erwin Vervondel <52445274+objt-ev@users.noreply.github.com>
Date: Sat, 4 May 2024 17:02:47 +0200
Subject: [PATCH] 1.3.0 add loki support
---
README.md | 5 +++--
log-elk-logger.html | 44 +++++++++++++++++++++++++++++++++++++++++++-
log-elk-logger.js | 27 +++++++++++++++++++++++++++
log-elk.html | 4 ++--
package.json | 12 +++++++-----
5 files changed, 82 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index e7d6ca2..4204758 100644
--- a/README.md
+++ b/README.md
@@ -2,12 +2,13 @@
A node-red logging output node supporting multiple output targets:
- ElasticSearch
+ - Loki (Grafana)
- File, including size and number of file specs
- System Console
- Debug Window
-This project uses the winston and winston-elasticsearch logging libraries
+This project uses the winston, winston-elasticsearch and winston-loki logging libraries
-Parts of this project is based on ['node-red-contrib-advance-logger'](https://github.com/jayathuam/node-red-contrib-advance-logger)
+Initial Parts of this project was based on ['node-red-contrib-advance-logger'](https://github.com/jayathuam/node-red-contrib-advance-logger)
diff --git a/log-elk-logger.html b/log-elk-logger.html
index 0683daf..c054b5a 100644
--- a/log-elk-logger.html
+++ b/log-elk-logger.html
@@ -3,15 +3,20 @@
category: 'config',
credentials: {
username: {type:"text"},
- password: {type:"password"}
+ password: {type:"password"},
+ loki_username: {type:"text"},
+ loki_password: {type:"password"}
},
defaults: {
name: { value: "" },
url: {value:"http://localhost:9200"},
+ loki_url: {value:"http://localhost:3100"},
+ loki_app: {value:"node-red"},
filename: { value: "log-elk.log", required: true },
maxsize: { value: 1, required: true, validate: function(v) { return v >= 1 } },
maxfiles: { value: 2, required: true, validate: function(v) { return v >= 1 } },
logelk: { value: false },
+ logloki: { value: false },
logfile: { value: false },
logconsole: { value: false },
logdebug: { value: false }
@@ -38,6 +43,17 @@
$("#elkfields").hide();
}
});
+
+ $("#node-config-input-logloki").on("change", function() {
+ if ($("#node-config-input-logloki").is(':checked')) {
+ $("#node-config-input-logloki").attr("file", "file");
+ $("#lokifields").show();
+ } else {
+ $("#node-config-input-logloki").removeAttr("file");
+ $("#lokifields").hide();
+ }
+ });
+
}
});
@@ -53,6 +69,10 @@
+
+
+
+
@@ -82,6 +102,28 @@
+