@theotherwillembotha/node-red-plugincore 0.0.50 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -21
- package/build/GenerateNodes.js +2 -0
- package/build/Nodes.html +174 -250
- package/build/Nodes.js +2 -0
- package/build/core/NodeConstructor.d.ts +4 -2
- package/build/core/NodeConstructor.d.ts.map +1 -1
- package/build/core/NodeConstructor.js +5 -3
- package/build/core/NodeGenerator.js +8 -8
- package/build/core/logger/node/ConsoleLoggerConfigNode.html +20 -61
- package/build/core/logger/node/LokiLoggerConfigNode.d.ts +1 -1
- package/build/core/logger/node/LokiLoggerConfigNode.html +37 -73
- package/build/core/logger/node/LokiLoggerConfigNode.js +1 -1
- package/build/core/logger/node/RestLoggerConfigNode.html +51 -77
- package/build/core/logger/node/RestLoggerConfigNode.js +1 -1
- package/build/core/logger/service/LoggerService.d.ts +1 -1
- package/build/core/logger/service/LoggerService.d.ts.map +1 -1
- package/build/core/logger/service/LoggerService.js +2 -3
- package/build/core/logger/template/LoggerTemplate.d.ts.map +1 -1
- package/build/core/logger/template/LoggerTemplate.html +15 -12
- package/build/core/logger/template/LoggerTemplate.js +1 -2
- package/build/core/metrics/MetricsDecorator.js +2 -2
- package/build/core/metrics/node/CounterMetricConfigNode.html +2 -2
- package/build/core/metrics/node/GaugeMetricConfigNode.html +2 -2
- package/build/core/metrics/node/GaugeMetricConfigNode.js +2 -2
- package/build/core/metrics/node/MetricsConfigNode.html +1 -1
- package/build/core/metrics/node/TimerMetricConfigNode.html +13 -13
- package/build/core/metrics/service/MetricsService.d.ts +1 -1
- package/build/core/metrics/service/MetricsService.js +6 -6
- package/build/core/metrics/template/CounterMetricTemplate.html +1 -1
- package/build/core/metrics/template/GaugeMetricTemplate.html +1 -1
- package/build/core/metrics/template/TimerMetricTemplate.html +1 -1
- package/build/core/other/node/DelegatedConfigReferenceNode.d.ts +57 -0
- package/build/core/other/node/DelegatedConfigReferenceNode.d.ts.map +1 -0
- package/build/core/other/node/DelegatedConfigReferenceNode.html +1 -0
- package/build/core/other/node/DelegatedConfigReferenceNode.js +79 -0
- package/build/core/tagging/NodeDescriptionDecorator.js +1 -1
- package/build/core/tagging/service/NodeTypeService.js +1 -1
- package/build/core/webhook/node/WebhookServerConfigNode.html +5 -5
- package/build/core/webhook/template/WebhookTemplate.html +18 -10
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/documentation/CounterMetricConfigNode.png +0 -0
- package/documentation/GaugeMetricConfigNode.png +0 -0
- package/documentation/MetricsConfigNode.png +0 -0
- package/documentation/TimerMetricConfigNode.png +0 -0
- package/documentation/WebhookNode.png +0 -0
- package/package.json +4 -3
- package/src/GenerateNodes.ts +3 -1
- package/src/core/NodeConstructor.ts +7 -4
- package/src/core/NodeGenerator.ts +8 -8
- package/src/core/logger/node/ConsoleLoggerConfigNode.html +20 -61
- package/src/core/logger/node/LokiLoggerConfigNode.html +37 -73
- package/src/core/logger/node/LokiLoggerConfigNode.ts +2 -2
- package/src/core/logger/node/RestLoggerConfigNode.html +51 -77
- package/src/core/logger/node/RestLoggerConfigNode.ts +1 -1
- package/src/core/logger/service/LoggerService.ts +3 -4
- package/src/core/logger/template/LoggerTemplate.html +15 -12
- package/src/core/logger/template/LoggerTemplate.ts +1 -2
- package/src/core/metrics/MetricsDecorator.ts +2 -2
- package/src/core/metrics/node/CounterMetricConfigNode.html +2 -2
- package/src/core/metrics/node/GaugeMetricConfigNode.html +2 -2
- package/src/core/metrics/node/GaugeMetricConfigNode.ts +2 -2
- package/src/core/metrics/node/MetricsConfigNode.html +1 -1
- package/src/core/metrics/node/MetricsConfigNode.ts +1 -1
- package/src/core/metrics/node/TimerMetricConfigNode.html +13 -13
- package/src/core/metrics/service/MetricsService.ts +6 -6
- package/src/core/metrics/template/CounterMetricTemplate.html +1 -1
- package/src/core/metrics/template/GaugeMetricTemplate.html +1 -1
- package/src/core/metrics/template/TimerMetricTemplate.html +1 -1
- package/src/core/other/node/DelegatedConfigReferenceNode.html +1 -0
- package/src/core/other/node/DelegatedConfigReferenceNode.ts +70 -0
- package/src/core/tagging/NodeDescriptionDecorator.ts +1 -1
- package/src/core/tagging/service/NodeTypeService.ts +1 -1
- package/src/core/webhook/node/WebhookServerConfigNode.html +5 -5
- package/src/core/webhook/template/WebhookTemplate.html +18 -10
- package/src/index.ts +1 -2
- package/build/core/logger/node/LoggerConfigNode.d.ts +0 -30
- package/build/core/logger/node/LoggerConfigNode.d.ts.map +0 -1
- package/build/core/logger/node/LoggerConfigNode.html +0 -307
- package/build/core/logger/node/LoggerConfigNode.js +0 -60
- package/src/core/logger/node/LoggerConfigNode.html +0 -307
- package/src/core/logger/node/LoggerConfigNode.ts +0 -95
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
.addDefault("level", {value:"info", required:true})
|
|
7
7
|
|
|
8
8
|
.addDefault("loki_host", {})
|
|
9
|
-
.addDefault("
|
|
9
|
+
.addDefault("loki_tenantid", {})
|
|
10
10
|
.addDefault("loki_userid", {})
|
|
11
11
|
.addDefault("loki_authtoken", {})
|
|
12
12
|
|
|
@@ -51,103 +51,67 @@
|
|
|
51
51
|
<script type="text/html" template-section="onIncludeEditForm">
|
|
52
52
|
<div id="LoggerConfig">
|
|
53
53
|
<div class="form-row">
|
|
54
|
-
<label for="node-config-input-name"><i class="fa fa-
|
|
54
|
+
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
55
55
|
<input type="text" id="node-config-input-name" />
|
|
56
56
|
</div>
|
|
57
57
|
|
|
58
58
|
<div class="form-row">
|
|
59
|
-
<label for="node-config-input-level"><i class="fa fa-
|
|
59
|
+
<label class="towb_editorlabel" for="node-config-input-level"><i class="fa fa-signal"></i> Level</label>
|
|
60
60
|
<input type="text" id="node-config-input-level" />
|
|
61
61
|
</div>
|
|
62
62
|
|
|
63
63
|
<div class="form-row">
|
|
64
|
-
<label for="node-config-input-loki_host"><i class="fa fa-
|
|
64
|
+
<label class="towb_editorlabel" for="node-config-input-loki_host"><i class="fa fa-server"></i> Host</label>
|
|
65
65
|
<input class="required" type="text" id="node-config-input-loki_host" />
|
|
66
66
|
</div>
|
|
67
67
|
<div class="form-row">
|
|
68
|
-
<label for="node-config-input-
|
|
69
|
-
<input class="" type="text" id="node-config-input-
|
|
68
|
+
<label class="towb_editorlabel" for="node-config-input-loki_tenantid"><i class="fa fa-building-o"></i> Tenant ID</label>
|
|
69
|
+
<input class="" type="text" id="node-config-input-loki_tenantid" />
|
|
70
70
|
</div>
|
|
71
71
|
<div class="form-row">
|
|
72
|
-
<label for="node-config-input-loki_userid"><i class="fa fa-
|
|
72
|
+
<label class="towb_editorlabel" for="node-config-input-loki_userid"><i class="fa fa-user"></i> Username</label>
|
|
73
73
|
<input class="" type="text" id="node-config-input-loki_userid" />
|
|
74
74
|
</div>
|
|
75
75
|
<div class="form-row">
|
|
76
|
-
<label for="node-config-input-loki_authtoken"><i class="fa fa-
|
|
76
|
+
<label class="towb_editorlabel" for="node-config-input-loki_authtoken"><i class="fa fa-key"></i> Auth Token</label>
|
|
77
77
|
<input class="" type="password" id="node-config-input-loki_authtoken" />
|
|
78
78
|
</div>
|
|
79
79
|
|
|
80
80
|
<div class="form-row">
|
|
81
|
-
<label for="node-config-input-templateEditor"><i class="fa fa-
|
|
81
|
+
<label class="towb_editorlabel" for="node-config-input-templateEditor"><i class="fa fa-code"></i> Template</label>
|
|
82
82
|
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-config-input-templateEditor"></div>
|
|
83
83
|
</div>
|
|
84
84
|
</div>
|
|
85
85
|
</script>
|
|
86
86
|
|
|
87
87
|
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
: *name*
|
|
92
|
-
: *level*
|
|
93
|
-
: *
|
|
94
|
-
: *
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
###
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
: *
|
|
108
|
-
|
|
109
|
-
####
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
##### APIKey
|
|
117
|
-
Provides authentication using a matrix parameter, header or query parameter and an apikey
|
|
118
|
-
|
|
119
|
-
: *mechanism* (mechanism) : the mechanism that will be used for transmitting the key (header, queryparam, matrixparam)
|
|
120
|
-
: *apikey name* (string) : the name of the key used for api authentication. (path variable or query param name)
|
|
121
|
-
: *apikey value*(string) : the value of the api key that will be transmitted. (beware of special characters)
|
|
122
|
-
|
|
123
|
-
### Loki
|
|
124
|
-
Publish the message to a loki endpoint.
|
|
125
|
-
|
|
126
|
-
: *host* (string) : the host and port\ of the loki instance that it being logged to
|
|
127
|
-
: *tenant* (string) : the tenant id that will be used to log to
|
|
128
|
-
: *username* (string) : the username for the loki instance.
|
|
129
|
-
: *authtoken* (string) : the authtoken for the loki instance.
|
|
130
|
-
|
|
131
|
-
# Mustache Templating
|
|
132
|
-
Mustache / Handlebars are used for building up the logged message payloads that are sent to the logging backend.
|
|
133
|
-
The resultant message will be interpreted as a string, meaning care should be taken in the event that a string representation of a json object is built.
|
|
134
|
-
|
|
135
|
-
### Provided Properties
|
|
136
|
-
A couple of values are provided to the logging context by default.
|
|
137
|
-
|
|
138
|
-
: *msg* (object) : an object containing the payload or message that should be parsed through the template.
|
|
139
|
-
: *currentTime* (object) : a string containing the current time in ISO8601 format
|
|
140
|
-
|
|
141
|
-
### Mustache Helpers
|
|
142
|
-
In addition to the provided properties, some "helpers" have also been provided to assist in serialization.
|
|
143
|
-
|
|
144
|
-
: *json* (helper) : converts a json object to a string using the JSON.stringify method.
|
|
145
|
-
|
|
146
|
-
## Examples
|
|
147
|
-
- {{{json msg}}} - serializes the the msg object to json format.
|
|
148
|
-
|
|
149
|
-
# References
|
|
150
|
-
- [Mustache - Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
|
|
151
|
-
- [Mustache - Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
|
|
88
|
+
Pushes log messages to a Grafana Loki instance using the Loki HTTP API.
|
|
89
|
+
|
|
90
|
+
### Properties
|
|
91
|
+
: *name* (string) : A descriptive name for this logger configuration.
|
|
92
|
+
: *level* (level) : The minimum log level. Messages below this threshold are suppressed. Options: DEBUG, INFO, WARNING, ERROR.
|
|
93
|
+
: *host* (string) : The base URL of the Loki instance, including port (e.g. `http://localhost:3100`).
|
|
94
|
+
: *tenant ID* (string) : The tenant identifier for multi-tenant Loki deployments (`X-Scope-OrgID` header). Leave blank for single-tenant deployments.
|
|
95
|
+
: *username* (string) : Username for Loki authentication.
|
|
96
|
+
: *auth token* (string) : Authentication token or password for Loki.
|
|
97
|
+
: *template* (mustache) : A Mustache/Handlebars template that formats the log message body.
|
|
98
|
+
|
|
99
|
+
### Mustache Templating
|
|
100
|
+
Mustache/Handlebars templates build the message string pushed to Loki.
|
|
101
|
+
|
|
102
|
+
#### Provided Properties
|
|
103
|
+
: *msg* (object) : The Node-RED message object passed through the node.
|
|
104
|
+
: *currentTime* (string) : The current time in ISO 8601 format.
|
|
105
|
+
|
|
106
|
+
#### Helpers
|
|
107
|
+
: *json* (helper) : Serialises an object to a JSON string using `JSON.stringify`.
|
|
108
|
+
|
|
109
|
+
#### Examples
|
|
110
|
+
- `{{{json msg}}}` — serialises the full message object as JSON.
|
|
111
|
+
|
|
112
|
+
#### References
|
|
113
|
+
- [Grafana Loki — HTTP API](https://grafana.com/docs/loki/latest/reference/loki-http-api/)
|
|
114
|
+
- [Mustache — Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
|
|
115
|
+
- [Mustache — Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
|
|
152
116
|
</script>
|
|
153
117
|
|
|
@@ -15,7 +15,7 @@ interface LokiLoggerConfigNodeConfig extends ConfigNodeConfig {
|
|
|
15
15
|
loki_host:string,
|
|
16
16
|
loki_userid?:string,
|
|
17
17
|
loki_authtoken?:string,
|
|
18
|
-
|
|
18
|
+
loki_tenantid?:string
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
@NodeDescription({
|
|
@@ -46,7 +46,7 @@ export class LokiLoggerConfigNode extends ConfigNode<LokiLoggerConfigNodeConfig>
|
|
|
46
46
|
host:config.loki_host,
|
|
47
47
|
userid:config.loki_userid,
|
|
48
48
|
authtoken:config.loki_authtoken,
|
|
49
|
-
tenantID:config.
|
|
49
|
+
tenantID:config.loki_tenantid,
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
this._logger = LoggerService.get(loggerConfig);
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
.addDefault("level", {value:"info", required:true})
|
|
7
7
|
|
|
8
8
|
// platform rest:
|
|
9
|
-
.addDefault("
|
|
10
|
-
.addDefault("
|
|
9
|
+
.addDefault("rest_url", {})
|
|
10
|
+
.addDefault("rest_ignoresslerror", {})
|
|
11
11
|
.addDefault("rest_auth_type", {})
|
|
12
12
|
.addDefault("rest_auth_basic_username", {})
|
|
13
13
|
.addDefault("rest_auth_basic_password", {})
|
|
@@ -88,122 +88,96 @@
|
|
|
88
88
|
<script type="text/html" template-section="onIncludeEditForm">
|
|
89
89
|
<div id="LoggerConfig">
|
|
90
90
|
<div class="form-row">
|
|
91
|
-
<label for="node-config-input-name"><i class="fa fa-
|
|
91
|
+
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
92
92
|
<input type="text" id="node-config-input-name" />
|
|
93
93
|
</div>
|
|
94
94
|
|
|
95
95
|
<div class="form-row">
|
|
96
|
-
<label for="node-config-input-level"><i class="fa fa-
|
|
96
|
+
<label class="towb_editorlabel" for="node-config-input-level"><i class="fa fa-signal"></i> Level</label>
|
|
97
97
|
<input type="text" id="node-config-input-level" />
|
|
98
98
|
</div>
|
|
99
99
|
|
|
100
100
|
<div class="platform platform-rest">
|
|
101
101
|
<div class="form-row">
|
|
102
|
-
<label for="node-config-input-rest_url"><i class="fa fa-
|
|
102
|
+
<label class="towb_editorlabel" for="node-config-input-rest_url"><i class="fa fa-link"></i> URL</label>
|
|
103
103
|
<input class="platform-rest-input required" type="text" id="node-config-input-rest_url" />
|
|
104
104
|
</div>
|
|
105
105
|
<div class="form-row">
|
|
106
|
-
<label></label>
|
|
106
|
+
<label class="towb_editorlabel"></label>
|
|
107
107
|
<input type="checkbox" id="node-config-input-rest_ignoresslerror" style="width:20px; margin-right:5px;" />
|
|
108
108
|
<label style="width:auto" for="node-config-input-rest_ignoresslerror"><span>Ignore Invalid SSL certificates</span></label>
|
|
109
109
|
</div>
|
|
110
110
|
<div class="form-row">
|
|
111
|
-
<label for="node-config-input-rest_auth_type"><i class="fa fa-
|
|
111
|
+
<label class="towb_editorlabel" for="node-config-input-rest_auth_type"><i class="fa fa-lock"></i> Authentication</label>
|
|
112
112
|
<input class="platform-rest-input required" type="text" id="node-config-input-rest_auth_type" />
|
|
113
113
|
</div>
|
|
114
114
|
<div class="form-row platform-rest-auth auth-basic">
|
|
115
|
-
<label for="node-config-input-rest_auth_basic_username"><i class="fa fa-
|
|
115
|
+
<label class="towb_editorlabel" for="node-config-input-rest_auth_basic_username"><i class="fa fa-user"></i> Username</label>
|
|
116
116
|
<input class="platform-rest-input" type="text" id="node-config-input-rest_auth_basic_username" />
|
|
117
117
|
</div>
|
|
118
118
|
<div class="form-row platform-rest-auth auth-basic">
|
|
119
|
-
<label for="node-config-input-rest_auth_basic_password"><i class="fa fa-
|
|
119
|
+
<label class="towb_editorlabel" for="node-config-input-rest_auth_basic_password"><i class="fa fa-key"></i> Password</label>
|
|
120
120
|
<input class="platform-rest-input" type="password" id="node-config-input-rest_auth_basic_password" />
|
|
121
121
|
</div>
|
|
122
122
|
<div class="form-row platform-rest-auth auth-apikey">
|
|
123
|
-
<label for="node-config-input-rest_auth_apikey_mechanism"><i class="fa fa-
|
|
123
|
+
<label class="towb_editorlabel" for="node-config-input-rest_auth_apikey_mechanism"><i class="fa fa-exchange"></i> Mechanism</label>
|
|
124
124
|
<input class="platform-rest-input" type="text" id="node-config-input-rest_auth_apikey_mechanism" />
|
|
125
125
|
</div>
|
|
126
126
|
<div class="form-row platform-rest-auth auth-apikey">
|
|
127
|
-
<label for="node-config-input-rest_auth_apikey_name"><i class="fa fa-
|
|
127
|
+
<label class="towb_editorlabel" for="node-config-input-rest_auth_apikey_name"><i class="fa fa-id-badge"></i> APIKey name</label>
|
|
128
128
|
<input class="platform-rest-input" type="text" id="node-config-input-rest_auth_apikey_name" />
|
|
129
129
|
</div>
|
|
130
130
|
<div class="form-row platform-rest-auth auth-apikey">
|
|
131
|
-
<label for="node-config-input-rest_auth_apikey_value"><i class="fa fa-
|
|
131
|
+
<label class="towb_editorlabel" for="node-config-input-rest_auth_apikey_value"><i class="fa fa-lock"></i> APIKey value</label>
|
|
132
132
|
<input class="platform-rest-input" type="text" id="node-config-input-rest_auth_apikey_value" />
|
|
133
133
|
</div>
|
|
134
134
|
</div>
|
|
135
135
|
|
|
136
136
|
<div class="form-row">
|
|
137
|
-
<label for="node-config-input-templateEditor"><i class="fa fa-
|
|
137
|
+
<label class="towb_editorlabel" for="node-config-input-templateEditor"><i class="fa fa-code"></i> Template</label>
|
|
138
138
|
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-config-input-templateEditor"></div>
|
|
139
139
|
</div>
|
|
140
140
|
</div>
|
|
141
141
|
</script>
|
|
142
142
|
|
|
143
143
|
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
: *name*
|
|
148
|
-
: *level*
|
|
149
|
-
: *
|
|
150
|
-
: *
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
: *
|
|
163
|
-
: *
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
: *
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
: *host* (string) : the host and port\ of the loki instance that it being logged to
|
|
183
|
-
: *tenant* (string) : the tenant id that will be used to log to
|
|
184
|
-
: *username* (string) : the username for the loki instance.
|
|
185
|
-
: *authtoken* (string) : the authtoken for the loki instance.
|
|
186
|
-
|
|
187
|
-
# Mustache Templating
|
|
188
|
-
Mustache / Handlebars are used for building up the logged message payloads that are sent to the logging backend.
|
|
189
|
-
The resultant message will be interpreted as a string, meaning care should be taken in the event that a string representation of a json object is built.
|
|
190
|
-
|
|
191
|
-
### Provided Properties
|
|
192
|
-
A couple of values are provided to the logging context by default.
|
|
193
|
-
|
|
194
|
-
: *msg* (object) : an object containing the payload or message that should be parsed through the template.
|
|
195
|
-
: *currentTime* (object) : a string containing the current time in ISO8601 format
|
|
196
|
-
|
|
197
|
-
### Mustache Helpers
|
|
198
|
-
In addition to the provided properties, some "helpers" have also been provided to assist in serialization.
|
|
199
|
-
|
|
200
|
-
: *json* (helper) : converts a json object to a string using the JSON.stringify method.
|
|
201
|
-
|
|
202
|
-
## Examples
|
|
203
|
-
- {{{json msg}}} - serializes the the msg object to json format.
|
|
204
|
-
|
|
205
|
-
# References
|
|
206
|
-
- [Mustache - Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
|
|
207
|
-
- [Mustache - Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
|
|
144
|
+
Posts log messages to an HTTP or HTTPS endpoint as a JSON payload.
|
|
145
|
+
|
|
146
|
+
### Properties
|
|
147
|
+
: *name* (string) : A descriptive name for this logger configuration.
|
|
148
|
+
: *level* (level) : The minimum log level. Messages below this threshold are suppressed. Options: DEBUG, INFO, WARNING, ERROR.
|
|
149
|
+
: *url* (url) : The endpoint that log messages will be POSTed to.
|
|
150
|
+
: *ignore SSL errors* (boolean) : When enabled, invalid SSL certificates are accepted.
|
|
151
|
+
: *authentication* (select) : The authentication strategy applied to each request. Options: None, Basic, ApiKey.
|
|
152
|
+
: *template* (mustache) : A Mustache/Handlebars template that formats the log message body.
|
|
153
|
+
|
|
154
|
+
### Authentication
|
|
155
|
+
#### Basic
|
|
156
|
+
Authenticates using the HTTP `Authorization` header (RFC 7617).
|
|
157
|
+
: *username* (string) : The username credential.
|
|
158
|
+
: *password* (string) : The password credential.
|
|
159
|
+
|
|
160
|
+
#### ApiKey
|
|
161
|
+
Authenticates by injecting a key/value pair into the request.
|
|
162
|
+
: *mechanism* (select) : Where the key is injected — Header, Query Param, or Matrix Param.
|
|
163
|
+
: *APIKey name* (string) : The name of the key (e.g. `x-api-key`).
|
|
164
|
+
: *APIKey value* (string) : The value of the key.
|
|
165
|
+
|
|
166
|
+
### Mustache Templating
|
|
167
|
+
Mustache/Handlebars templates build the message string POSTed to the endpoint.
|
|
168
|
+
|
|
169
|
+
#### Provided Properties
|
|
170
|
+
: *msg* (object) : The Node-RED message object passed through the node.
|
|
171
|
+
: *currentTime* (string) : The current time in ISO 8601 format.
|
|
172
|
+
|
|
173
|
+
#### Helpers
|
|
174
|
+
: *json* (helper) : Serialises an object to a JSON string using `JSON.stringify`.
|
|
175
|
+
|
|
176
|
+
#### Examples
|
|
177
|
+
- `{{{json msg}}}` — serialises the full message object as JSON.
|
|
178
|
+
|
|
179
|
+
#### References
|
|
180
|
+
- [Mustache — Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
|
|
181
|
+
- [Mustache — Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
|
|
208
182
|
</script>
|
|
209
183
|
|
|
@@ -24,7 +24,7 @@ interface RestLoggerConfigNodeConfig extends ConfigNodeConfig {
|
|
|
24
24
|
|
|
25
25
|
@NodeDescription({
|
|
26
26
|
id:"RestLoggerConfigNode",
|
|
27
|
-
name:"
|
|
27
|
+
name:"Rest Endpoint Logger",
|
|
28
28
|
group:"config",
|
|
29
29
|
sourceFile:SourceUtility.getSourcePath("/build/", "/src/") + "RestLoggerConfigNode.html",
|
|
30
30
|
package: "@theotherwillembotha/node-red-plugincore",
|
|
@@ -5,7 +5,6 @@ import Handlebars from "handlebars";
|
|
|
5
5
|
import { createLogger, format, transports } from "winston";
|
|
6
6
|
import LokiTransport from "winston-loki";
|
|
7
7
|
import { URLRecord, parseURL } from 'whatwg-url';
|
|
8
|
-
import { LoggerConfigNode } from "../node/LoggerConfigNode";
|
|
9
8
|
import { LoggerTemplate } from "../template/LoggerTemplate";
|
|
10
9
|
var network = require('network');
|
|
11
10
|
import deepEqual from "deep-equal";
|
|
@@ -137,7 +136,7 @@ export interface LokiLoggerConfig extends BaseLoggerConfig{
|
|
|
137
136
|
host:string;
|
|
138
137
|
userid?:string;
|
|
139
138
|
authtoken?:string;
|
|
140
|
-
|
|
139
|
+
tenantid?:string;
|
|
141
140
|
}
|
|
142
141
|
|
|
143
142
|
class LokiLogger extends NewLogger<LokiLoggerConfig>{
|
|
@@ -151,7 +150,7 @@ class LokiLogger extends NewLogger<LokiLoggerConfig>{
|
|
|
151
150
|
json: true,
|
|
152
151
|
format: format.json(),
|
|
153
152
|
headers: {
|
|
154
|
-
"X-Scope-OrgID": (config.
|
|
153
|
+
"X-Scope-OrgID": (config.tenantid) ? config.tenantid : undefined
|
|
155
154
|
},
|
|
156
155
|
replaceTimestamp: true,
|
|
157
156
|
onConnectionError: (err:unknown) => console.error(err),
|
|
@@ -301,7 +300,7 @@ export class LoggerService extends BaseService {
|
|
|
301
300
|
"services-plugin",
|
|
302
301
|
"@theotherwillembotha/node-red-plugincore",
|
|
303
302
|
LoggerService,
|
|
304
|
-
[
|
|
303
|
+
[LoggerTemplate]
|
|
305
304
|
);
|
|
306
305
|
}
|
|
307
306
|
}
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
<script type="text/javascript" template-section="onCompose">
|
|
103
103
|
node
|
|
104
104
|
.addDefault("logEnabled", { value:false, required:true})
|
|
105
|
-
.addDefault("logger", { required:false})
|
|
105
|
+
.addDefault("logger", { required:false, value:'', type:"DelegatedConfigReferenceNode"})
|
|
106
106
|
.addDefault("logTemplateOverrideEnabled", {value:false})
|
|
107
107
|
.addDefault("logTemplateOverride", {value:"message:{{msg}}"})
|
|
108
108
|
</script>
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
value: node.logTemplateOverride
|
|
187
187
|
});
|
|
188
188
|
|
|
189
|
-
let loggerSelector = $("#
|
|
189
|
+
let loggerSelector = $("#logger-selector");
|
|
190
190
|
let loggerEditButton = $("#logger-edit-btn");
|
|
191
191
|
let loggerAddButton = $("#logger-add-btn");
|
|
192
192
|
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
|
|
200
200
|
// figure out what type of logger this is.
|
|
201
201
|
let selectedLogger = (await getLoggers()).find(logger => logger.id === loggerSelector.val());
|
|
202
|
-
RED.editor.editConfig("#
|
|
202
|
+
RED.editor.editConfig("#logger-selector", selectedLogger.type, selectedLogger.id);
|
|
203
203
|
});
|
|
204
204
|
|
|
205
205
|
loggerAddButton.on('click', function(event) {
|
|
@@ -223,14 +223,14 @@
|
|
|
223
223
|
.appendTo($dropdown);
|
|
224
224
|
});
|
|
225
225
|
|
|
226
|
-
//
|
|
226
|
+
// Append first so outerWidth() is measurable, then position so the
|
|
227
|
+
// right edge of the dropdown aligns with the right edge of the button.
|
|
228
|
+
$('body').append($dropdown);
|
|
227
229
|
$dropdown.css({
|
|
228
|
-
top: $btn.offset().top + $btn.
|
|
229
|
-
left: $btn.offset().left
|
|
230
|
+
top: $btn.offset().top + $btn.outerHeight(),
|
|
231
|
+
left: $btn.offset().left + $btn.outerWidth() - $dropdown.outerWidth()
|
|
230
232
|
});
|
|
231
233
|
|
|
232
|
-
$('body').append($dropdown);
|
|
233
|
-
|
|
234
234
|
$(document).on('mousedown.dropdown', function(e) {
|
|
235
235
|
if (!$(e.target).closest('.loggertype-dropdown').length) {
|
|
236
236
|
$dropdown.remove();
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
// Do whatever you need with the selection
|
|
248
248
|
console.log('Selected:', selectedValue, selectedText);
|
|
249
249
|
$dropdown.remove();
|
|
250
|
-
RED.editor.editConfig("#
|
|
250
|
+
RED.editor.editConfig("#logger-selector", selectedValue, "_ADD_");
|
|
251
251
|
});
|
|
252
252
|
})
|
|
253
253
|
});
|
|
@@ -265,12 +265,15 @@
|
|
|
265
265
|
// lastly, make sure that we set the correct value on the logger selector.
|
|
266
266
|
updateLoggerSelectorList().then(() => {
|
|
267
267
|
loggerSelector.val(node.logger);
|
|
268
|
+
loggerSelector.trigger('change');
|
|
268
269
|
});
|
|
269
270
|
|
|
270
271
|
</script>
|
|
271
272
|
|
|
272
273
|
<script type="text/javascript" template-section="onIncludeEditSave">
|
|
273
274
|
node = this;
|
|
275
|
+
var selectedLogger = $("#logger-selector").val();
|
|
276
|
+
node.logger = (selectedLogger && selectedLogger !== "_ADD_") ? selectedLogger : '';
|
|
274
277
|
node.logTemplateOverride = node.logTemplateOverrideEditor.getValue();
|
|
275
278
|
node.logTemplateOverrideEditor.destroy();
|
|
276
279
|
delete node.logTemplateOverrideEditor;
|
|
@@ -289,9 +292,9 @@
|
|
|
289
292
|
|
|
290
293
|
<div id="section_logEnabled">
|
|
291
294
|
<div class="form-row nomargin">
|
|
292
|
-
<label for="
|
|
295
|
+
<label for="logger-selector">Logger</label>
|
|
293
296
|
<div style="width: 70%; display: inline-flex;">
|
|
294
|
-
<select id="
|
|
297
|
+
<select id="logger-selector" style="flex-grow: 1;" class="">
|
|
295
298
|
<option value="_ADD_">none</option>
|
|
296
299
|
</select>
|
|
297
300
|
<a id="logger-edit-btn" class="red-ui-button disabled" style="margin-left: 10px;">
|
|
@@ -310,7 +313,7 @@
|
|
|
310
313
|
|
|
311
314
|
<div id="section_logTemplateOverrideEnabled">
|
|
312
315
|
<div class="form-row">
|
|
313
|
-
<label for="node-input-logTemplateOverrideEditor"><i class="fa fa-
|
|
316
|
+
<label class="towb_editorlabel" for="node-input-logTemplateOverrideEditor"><i class="fa fa-code"></i> Template</label>
|
|
314
317
|
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-logTemplateOverrideEditor"></div>
|
|
315
318
|
</div>
|
|
316
319
|
</div>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SourceUtility } from "../../NodeGenerator";
|
|
2
2
|
import { BaseNodeConfig, Template, TemplateDescriptor } from "../../NodeConstructor"
|
|
3
|
-
import { LoggerConfigNode } from "../node/LoggerConfigNode";
|
|
4
3
|
|
|
5
4
|
export interface LoggerTemplateConfig extends BaseNodeConfig{
|
|
6
5
|
logEnabled:boolean,
|
|
@@ -17,7 +16,7 @@ export class LoggerTemplate extends Template {
|
|
|
17
16
|
"logger",
|
|
18
17
|
LoggerTemplate,
|
|
19
18
|
SourceUtility.getSourcePath("/build/", "/src/") + "LoggerTemplate.html",
|
|
20
|
-
[
|
|
19
|
+
[],
|
|
21
20
|
)
|
|
22
21
|
}
|
|
23
22
|
}
|
|
@@ -100,7 +100,7 @@ export function Metrics(metricsConfig: MetricsConfig):Function {
|
|
|
100
100
|
metricdescription:metricsConfig.description,
|
|
101
101
|
node:nde
|
|
102
102
|
};
|
|
103
|
-
this[valueSymbol] = _metrics.
|
|
103
|
+
this[valueSymbol] = _metrics.gauge(gaugeConfig);
|
|
104
104
|
return this[valueSymbol];
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -183,7 +183,7 @@ export function Metrics(metricsConfig: MetricsConfig):Function {
|
|
|
183
183
|
metricdescription:metricsConfig.description,
|
|
184
184
|
node:nde
|
|
185
185
|
};
|
|
186
|
-
this[valueSymbol] = _metrics.
|
|
186
|
+
this[valueSymbol] = _metrics.gauge(gaugeConfig);
|
|
187
187
|
return this[valueSymbol];
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
<script type="text/html" template-section="onIncludeEditForm">
|
|
21
21
|
<div id="MetricsConfig">
|
|
22
22
|
<div class="form-row">
|
|
23
|
-
<label for="node-config-input-name"><i class="fa fa-
|
|
23
|
+
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
24
24
|
<input type="text" id="node-config-input-name" />
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
27
|
<div class="form-row">
|
|
28
|
-
<label for="node-config-input-description"><i class="fa fa-
|
|
28
|
+
<label class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-info-circle"></i> Description</label>
|
|
29
29
|
<input type="text" id="node-config-input-description" />
|
|
30
30
|
</div>
|
|
31
31
|
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
<script type="text/html" template-section="onIncludeEditForm">
|
|
21
21
|
<div id="MetricsConfig">
|
|
22
22
|
<div class="form-row">
|
|
23
|
-
<label for="node-config-input-name"><i class="fa fa-
|
|
23
|
+
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
24
24
|
<input type="text" id="node-config-input-name">
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
27
|
<div class="form-row">
|
|
28
|
-
<label for="node-config-input-description"><i class="fa fa-
|
|
28
|
+
<label class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-info-circle"></i> Description</label>
|
|
29
29
|
<input type="text" id="node-config-input-description">
|
|
30
30
|
</div>
|
|
31
31
|
|
|
@@ -14,7 +14,7 @@ interface GaugeMetricConfigNodeConfig extends ConfigNodeConfig, GaugeMetricConfi
|
|
|
14
14
|
|
|
15
15
|
@NodeDescription({
|
|
16
16
|
id:"GaugeMetricConfigNode",
|
|
17
|
-
name:"
|
|
17
|
+
name:"Gauge Metric Config Node",
|
|
18
18
|
group:"config",
|
|
19
19
|
sourceFile:SourceUtility.getSourcePath("/build/", "/src/") + "GaugeMetricConfigNode.html",
|
|
20
20
|
package: "@theotherwillembotha/node-red-plugincore",
|
|
@@ -45,7 +45,7 @@ export class GaugeMetricConfigNode extends ConfigNode<GaugeMetricConfigNodeConfi
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
this._gauge = this._metrics.
|
|
48
|
+
this._gauge = this._metrics.gauge(gaugeConfig);
|
|
49
49
|
|
|
50
50
|
if(config.reset){
|
|
51
51
|
_this._gauge.reset();
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<script type="text/html" template-section="onIncludeEditForm">
|
|
9
9
|
<div id="MetricsConfig">
|
|
10
10
|
<div class="form-row">
|
|
11
|
-
<label for="node-config-input-name"><i class="fa fa-
|
|
11
|
+
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
12
12
|
<input type="text" id="node-config-input-name" />
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
@@ -16,7 +16,7 @@ The metrics / repositories are menanaged by the plugin and triggered when the fl
|
|
|
16
16
|
|
|
17
17
|
The reasoning for this is that the Metrics exist outside of the flow, but is configured using the flow.
|
|
18
18
|
Basically, if the metrics arent changed, we dont have to redeploy the metrics, which means that
|
|
19
|
-
stuff like coutners,
|
|
19
|
+
stuff like coutners, gauges and timers are not reset.
|
|
20
20
|
*/
|
|
21
21
|
interface MetricsConfigNodeConfig extends ConfigNodeConfig, WebhookTemplateConfig {
|
|
22
22
|
}
|