@5minds/node-red-contrib-processcube-elasticsearch 0.3.3-feature-056883-m66btl04 → 0.3.3-feature-6d666d-m66j64bn
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.
|
@@ -427,320 +427,6 @@
|
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
},
|
|
430
|
-
"@flowfuse/node-red-dashboard": {
|
|
431
|
-
"name": "@flowfuse/node-red-dashboard",
|
|
432
|
-
"version": "1.22.0",
|
|
433
|
-
"local": false,
|
|
434
|
-
"user": false,
|
|
435
|
-
"nodes": {
|
|
436
|
-
"ui-base": {
|
|
437
|
-
"name": "ui-base",
|
|
438
|
-
"types": [
|
|
439
|
-
"ui-base"
|
|
440
|
-
],
|
|
441
|
-
"enabled": true,
|
|
442
|
-
"local": false,
|
|
443
|
-
"user": false,
|
|
444
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
445
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/config/ui_base.js"
|
|
446
|
-
},
|
|
447
|
-
"ui-page": {
|
|
448
|
-
"name": "ui-page",
|
|
449
|
-
"types": [
|
|
450
|
-
"ui-page"
|
|
451
|
-
],
|
|
452
|
-
"enabled": true,
|
|
453
|
-
"local": false,
|
|
454
|
-
"user": false,
|
|
455
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
456
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/config/ui_page.js"
|
|
457
|
-
},
|
|
458
|
-
"ui-link": {
|
|
459
|
-
"name": "ui-link",
|
|
460
|
-
"types": [
|
|
461
|
-
"ui-link"
|
|
462
|
-
],
|
|
463
|
-
"enabled": true,
|
|
464
|
-
"local": false,
|
|
465
|
-
"user": false,
|
|
466
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
467
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/config/ui_link.js"
|
|
468
|
-
},
|
|
469
|
-
"ui-group": {
|
|
470
|
-
"name": "ui-group",
|
|
471
|
-
"types": [
|
|
472
|
-
"ui-group"
|
|
473
|
-
],
|
|
474
|
-
"enabled": true,
|
|
475
|
-
"local": false,
|
|
476
|
-
"user": false,
|
|
477
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
478
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/config/ui_group.js"
|
|
479
|
-
},
|
|
480
|
-
"ui-theme": {
|
|
481
|
-
"name": "ui-theme",
|
|
482
|
-
"types": [
|
|
483
|
-
"ui-theme"
|
|
484
|
-
],
|
|
485
|
-
"enabled": true,
|
|
486
|
-
"local": false,
|
|
487
|
-
"user": false,
|
|
488
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
489
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/config/ui_theme.js"
|
|
490
|
-
},
|
|
491
|
-
"ui-form": {
|
|
492
|
-
"name": "ui-form",
|
|
493
|
-
"types": [
|
|
494
|
-
"ui-form"
|
|
495
|
-
],
|
|
496
|
-
"enabled": true,
|
|
497
|
-
"local": false,
|
|
498
|
-
"user": false,
|
|
499
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
500
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_form.js"
|
|
501
|
-
},
|
|
502
|
-
"ui-text-input": {
|
|
503
|
-
"name": "ui-text-input",
|
|
504
|
-
"types": [
|
|
505
|
-
"ui-text-input"
|
|
506
|
-
],
|
|
507
|
-
"enabled": true,
|
|
508
|
-
"local": false,
|
|
509
|
-
"user": false,
|
|
510
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
511
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_text_input.js"
|
|
512
|
-
},
|
|
513
|
-
"ui-number-input": {
|
|
514
|
-
"name": "ui-number-input",
|
|
515
|
-
"types": [
|
|
516
|
-
"ui-number-input"
|
|
517
|
-
],
|
|
518
|
-
"enabled": true,
|
|
519
|
-
"local": false,
|
|
520
|
-
"user": false,
|
|
521
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
522
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_number_input.js"
|
|
523
|
-
},
|
|
524
|
-
"ui-file-input": {
|
|
525
|
-
"name": "ui-file-input",
|
|
526
|
-
"types": [
|
|
527
|
-
"ui-file-input"
|
|
528
|
-
],
|
|
529
|
-
"enabled": true,
|
|
530
|
-
"local": false,
|
|
531
|
-
"user": false,
|
|
532
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
533
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_file_input.js"
|
|
534
|
-
},
|
|
535
|
-
"ui-button": {
|
|
536
|
-
"name": "ui-button",
|
|
537
|
-
"types": [
|
|
538
|
-
"ui-button"
|
|
539
|
-
],
|
|
540
|
-
"enabled": true,
|
|
541
|
-
"local": false,
|
|
542
|
-
"user": false,
|
|
543
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
544
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_button.js"
|
|
545
|
-
},
|
|
546
|
-
"ui-button-group": {
|
|
547
|
-
"name": "ui-button-group",
|
|
548
|
-
"types": [
|
|
549
|
-
"ui-button-group"
|
|
550
|
-
],
|
|
551
|
-
"enabled": true,
|
|
552
|
-
"local": false,
|
|
553
|
-
"user": false,
|
|
554
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
555
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_button_group.js"
|
|
556
|
-
},
|
|
557
|
-
"ui-dropdown": {
|
|
558
|
-
"name": "ui-dropdown",
|
|
559
|
-
"types": [
|
|
560
|
-
"ui-dropdown"
|
|
561
|
-
],
|
|
562
|
-
"enabled": true,
|
|
563
|
-
"local": false,
|
|
564
|
-
"user": false,
|
|
565
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
566
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_dropdown.js"
|
|
567
|
-
},
|
|
568
|
-
"ui-radio-group": {
|
|
569
|
-
"name": "ui-radio-group",
|
|
570
|
-
"types": [
|
|
571
|
-
"ui-radio-group"
|
|
572
|
-
],
|
|
573
|
-
"enabled": true,
|
|
574
|
-
"local": false,
|
|
575
|
-
"user": false,
|
|
576
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
577
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_radio_group.js"
|
|
578
|
-
},
|
|
579
|
-
"ui-slider": {
|
|
580
|
-
"name": "ui-slider",
|
|
581
|
-
"types": [
|
|
582
|
-
"ui-slider"
|
|
583
|
-
],
|
|
584
|
-
"enabled": true,
|
|
585
|
-
"local": false,
|
|
586
|
-
"user": false,
|
|
587
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
588
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_slider.js"
|
|
589
|
-
},
|
|
590
|
-
"ui-spacer": {
|
|
591
|
-
"name": "ui-spacer",
|
|
592
|
-
"types": [
|
|
593
|
-
"ui-spacer"
|
|
594
|
-
],
|
|
595
|
-
"enabled": true,
|
|
596
|
-
"local": false,
|
|
597
|
-
"user": false,
|
|
598
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
599
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_spacer.js"
|
|
600
|
-
},
|
|
601
|
-
"ui-switch": {
|
|
602
|
-
"name": "ui-switch",
|
|
603
|
-
"types": [
|
|
604
|
-
"ui-switch"
|
|
605
|
-
],
|
|
606
|
-
"enabled": true,
|
|
607
|
-
"local": false,
|
|
608
|
-
"user": false,
|
|
609
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
610
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_switch.js"
|
|
611
|
-
},
|
|
612
|
-
"ui-text": {
|
|
613
|
-
"name": "ui-text",
|
|
614
|
-
"types": [
|
|
615
|
-
"ui-text"
|
|
616
|
-
],
|
|
617
|
-
"enabled": true,
|
|
618
|
-
"local": false,
|
|
619
|
-
"user": false,
|
|
620
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
621
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_text.js"
|
|
622
|
-
},
|
|
623
|
-
"ui-table": {
|
|
624
|
-
"name": "ui-table",
|
|
625
|
-
"types": [
|
|
626
|
-
"ui-table"
|
|
627
|
-
],
|
|
628
|
-
"enabled": true,
|
|
629
|
-
"local": false,
|
|
630
|
-
"user": false,
|
|
631
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
632
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_table.js"
|
|
633
|
-
},
|
|
634
|
-
"ui-chart": {
|
|
635
|
-
"name": "ui-chart",
|
|
636
|
-
"types": [
|
|
637
|
-
"ui-chart"
|
|
638
|
-
],
|
|
639
|
-
"enabled": true,
|
|
640
|
-
"local": false,
|
|
641
|
-
"user": false,
|
|
642
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
643
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_chart.js"
|
|
644
|
-
},
|
|
645
|
-
"ui-gauge": {
|
|
646
|
-
"name": "ui-gauge",
|
|
647
|
-
"types": [
|
|
648
|
-
"ui-gauge"
|
|
649
|
-
],
|
|
650
|
-
"enabled": true,
|
|
651
|
-
"local": false,
|
|
652
|
-
"user": false,
|
|
653
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
654
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_gauge.js"
|
|
655
|
-
},
|
|
656
|
-
"ui-notification": {
|
|
657
|
-
"name": "ui-notification",
|
|
658
|
-
"types": [
|
|
659
|
-
"ui-notification"
|
|
660
|
-
],
|
|
661
|
-
"enabled": true,
|
|
662
|
-
"local": false,
|
|
663
|
-
"user": false,
|
|
664
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
665
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_notification.js"
|
|
666
|
-
},
|
|
667
|
-
"ui-audio": {
|
|
668
|
-
"name": "ui-audio",
|
|
669
|
-
"types": [
|
|
670
|
-
"ui-audio"
|
|
671
|
-
],
|
|
672
|
-
"enabled": true,
|
|
673
|
-
"local": false,
|
|
674
|
-
"user": false,
|
|
675
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
676
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_audio.js"
|
|
677
|
-
},
|
|
678
|
-
"ui-markdown": {
|
|
679
|
-
"name": "ui-markdown",
|
|
680
|
-
"types": [
|
|
681
|
-
"ui-markdown"
|
|
682
|
-
],
|
|
683
|
-
"enabled": true,
|
|
684
|
-
"local": false,
|
|
685
|
-
"user": false,
|
|
686
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
687
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_markdown.js"
|
|
688
|
-
},
|
|
689
|
-
"ui-template": {
|
|
690
|
-
"name": "ui-template",
|
|
691
|
-
"types": [
|
|
692
|
-
"ui-template"
|
|
693
|
-
],
|
|
694
|
-
"enabled": true,
|
|
695
|
-
"local": false,
|
|
696
|
-
"user": false,
|
|
697
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
698
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_template.js"
|
|
699
|
-
},
|
|
700
|
-
"ui-event": {
|
|
701
|
-
"name": "ui-event",
|
|
702
|
-
"types": [
|
|
703
|
-
"ui-event"
|
|
704
|
-
],
|
|
705
|
-
"enabled": true,
|
|
706
|
-
"local": false,
|
|
707
|
-
"user": false,
|
|
708
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
709
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_event.js"
|
|
710
|
-
},
|
|
711
|
-
"ui-control": {
|
|
712
|
-
"name": "ui-control",
|
|
713
|
-
"types": [
|
|
714
|
-
"ui-control"
|
|
715
|
-
],
|
|
716
|
-
"enabled": true,
|
|
717
|
-
"local": false,
|
|
718
|
-
"user": false,
|
|
719
|
-
"module": "@flowfuse/node-red-dashboard",
|
|
720
|
-
"file": "/usr/src/node-red/node_modules/@flowfuse/node-red-dashboard/nodes/widgets/ui_control.js"
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
},
|
|
724
|
-
"node-red-contrib-oauth2": {
|
|
725
|
-
"name": "node-red-contrib-oauth2",
|
|
726
|
-
"version": "6.2.1",
|
|
727
|
-
"local": false,
|
|
728
|
-
"user": false,
|
|
729
|
-
"nodes": {
|
|
730
|
-
"oauth2": {
|
|
731
|
-
"name": "oauth2",
|
|
732
|
-
"types": [
|
|
733
|
-
"oauth2",
|
|
734
|
-
"oauth2"
|
|
735
|
-
],
|
|
736
|
-
"enabled": true,
|
|
737
|
-
"local": false,
|
|
738
|
-
"user": false,
|
|
739
|
-
"module": "node-red-contrib-oauth2",
|
|
740
|
-
"file": "/usr/src/node-red/node_modules/node-red-contrib-oauth2/src/oauth2.js"
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
},
|
|
744
430
|
"@5minds/node-red-contrib-processcube-elasticsearch": {
|
|
745
431
|
"name": "@5minds/node-red-contrib-processcube-elasticsearch",
|
|
746
432
|
"version": "0.3.2",
|
|
@@ -9,5 +9,12 @@ try {
|
|
|
9
9
|
console.log(">>>", e);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
process.on('uncaughtException', (err) => {
|
|
13
|
+
console.error(`Uncaught Exception: ${err}`, {});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
17
|
+
console.error(`Unhandled Rejection at ${promise} reason: ${reason}`, {});
|
|
18
|
+
});
|
|
12
19
|
|
|
13
20
|
module.exports = config;
|
package/elastic-search-logger.js
CHANGED
|
@@ -1,36 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const winston = require('winston');
|
|
4
|
+
const winstonElasticSearch = require('winston-elasticsearch');
|
|
5
|
+
const { ElasticsearchTransformer } = require('winston-elasticsearch');
|
|
6
|
+
|
|
7
|
+
const logLevels = {
|
|
8
|
+
levels: {
|
|
9
|
+
Error: 0,
|
|
10
|
+
Warning: 1,
|
|
11
|
+
Information: 2,
|
|
12
|
+
Debug: 3
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function setElasticFields(logData) {
|
|
17
|
+
const transformed = ElasticsearchTransformer(logData);
|
|
18
|
+
|
|
19
|
+
transformed['@timestamp'] = logData.timestamp ? logData.timestamp : new Date().toISOString();
|
|
20
|
+
transformed.message = logData.message;
|
|
21
|
+
transformed.messageTemplate = logData.messageTemplate;
|
|
22
|
+
transformed.severity = logData.level;
|
|
23
|
+
transformed.level = logData.level;
|
|
24
|
+
transformed.fields = logData.meta;
|
|
25
|
+
|
|
26
|
+
if (logData.meta['transaction.id']) {
|
|
27
|
+
transformed.transaction = { id: logData.meta['transaction.id'] };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (logData.meta['trace.id']) {
|
|
31
|
+
transformed.trace = {
|
|
32
|
+
id: logData.meta['trace.id']
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (logData.meta['span.id']) {
|
|
37
|
+
transformed.span = {
|
|
38
|
+
id: logData.meta['span.id']
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return transformed;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
1
46
|
module.exports = function (RED) {
|
|
2
|
-
'use strict';
|
|
3
47
|
|
|
4
48
|
function LogElasticLoggerNode(config) {
|
|
5
|
-
let winston = require('winston');
|
|
6
|
-
let winstonElasticSearch = require('winston-elasticsearch');
|
|
7
|
-
|
|
8
49
|
RED.nodes.createNode(this, config);
|
|
9
|
-
|
|
10
|
-
|
|
50
|
+
const node = this;
|
|
51
|
+
|
|
52
|
+
node.logger = null;
|
|
11
53
|
|
|
12
54
|
// Elastic settings
|
|
13
|
-
|
|
55
|
+
const url = RED.util.evaluateNodeProperty(config.url, config.urlType, node);
|
|
14
56
|
if (url == '') {
|
|
15
|
-
|
|
57
|
+
node.error('Elastic search url is not set', {});
|
|
16
58
|
}
|
|
17
59
|
|
|
18
|
-
|
|
60
|
+
const user = RED.util.evaluateNodeProperty(this.credentials.username, config.usernameType, node);
|
|
19
61
|
if (user == '') {
|
|
20
|
-
|
|
62
|
+
node.error('Elastic search username is not set', {});
|
|
21
63
|
}
|
|
22
64
|
|
|
23
|
-
|
|
65
|
+
const password = RED.util.evaluateNodeProperty(this.credentials.password, config.passwordType, node);
|
|
24
66
|
if (password == '') {
|
|
25
|
-
|
|
67
|
+
node.error('Elastic search password is not set', {});
|
|
26
68
|
}
|
|
27
69
|
|
|
28
|
-
let index = RED.util.evaluateNodeProperty(this.credentials.index, config.indexType,
|
|
70
|
+
let index = RED.util.evaluateNodeProperty(this.credentials.index, config.indexType, node);
|
|
29
71
|
if (index == '') {
|
|
30
|
-
|
|
72
|
+
node.error('Elastic search index is not set', {});
|
|
73
|
+
} else {
|
|
74
|
+
index = index.toLowerCase();
|
|
31
75
|
}
|
|
32
76
|
|
|
33
|
-
|
|
77
|
+
let transports = [];
|
|
78
|
+
|
|
34
79
|
if (url) {
|
|
35
80
|
const elasticSearchTransport = new winstonElasticSearch.ElasticsearchTransport({
|
|
36
81
|
clientOpts: {
|
|
@@ -44,26 +89,23 @@ module.exports = function (RED) {
|
|
|
44
89
|
rejectUnauthorized: false,
|
|
45
90
|
},
|
|
46
91
|
},
|
|
47
|
-
transformer: (logData) =>
|
|
92
|
+
transformer: (logData) => {
|
|
93
|
+
try {
|
|
94
|
+
setElasticFields(logData);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
node.error(error, {});
|
|
97
|
+
}
|
|
98
|
+
},
|
|
48
99
|
index: index,
|
|
49
100
|
});
|
|
50
101
|
|
|
51
102
|
transports.push(elasticSearchTransport);
|
|
52
103
|
|
|
53
104
|
elasticSearchTransport.on('error', (error) => {
|
|
54
|
-
|
|
55
|
-
console.error('Error in elasticSearchTransport caught', error);
|
|
105
|
+
node.error(`Error in elasticSearchTransport caught: ${error.message}`, {});
|
|
56
106
|
});
|
|
57
107
|
}
|
|
58
108
|
|
|
59
|
-
let logLevels = {
|
|
60
|
-
levels: {
|
|
61
|
-
Error: 0,
|
|
62
|
-
Warning: 1,
|
|
63
|
-
Information: 2,
|
|
64
|
-
Debug: 3,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
109
|
this.logger = new winston.createLogger({
|
|
68
110
|
exitOnError: false,
|
|
69
111
|
level: 'Debug',
|
|
@@ -71,36 +113,29 @@ module.exports = function (RED) {
|
|
|
71
113
|
transports: transports,
|
|
72
114
|
});
|
|
73
115
|
|
|
116
|
+
this.logger.on('error', (error) => {
|
|
117
|
+
node.error(error, {});
|
|
118
|
+
});
|
|
119
|
+
|
|
74
120
|
this.debug('elastic-search logger created');
|
|
75
121
|
|
|
76
|
-
this.on('close', function (
|
|
122
|
+
this.on('close', function () {
|
|
77
123
|
// close logger
|
|
78
|
-
if (
|
|
79
|
-
|
|
124
|
+
if (node.logger) {
|
|
125
|
+
node.logger.close();
|
|
80
126
|
}
|
|
81
127
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (done) done();
|
|
128
|
+
node.debug('elastic-search logger closed');
|
|
85
129
|
});
|
|
86
130
|
}
|
|
87
131
|
|
|
88
|
-
function
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
transformed.level = logData.level;
|
|
96
|
-
transformed.fields = logData.meta;
|
|
97
|
-
|
|
98
|
-
if (logData.meta['transaction.id']) transformed.transaction = { id: logData.meta['transaction.id'] };
|
|
99
|
-
if (logData.meta['trace.id']) transformed.trace = { id: logData.meta['trace.id'] };
|
|
100
|
-
if (logData.meta['span.id']) transformed.span = { id: logData.meta['span.id'] };
|
|
101
|
-
|
|
102
|
-
return transformed;
|
|
103
|
-
}
|
|
132
|
+
LogElasticLoggerNode.prototype.addToLog = function addTolog(loglevel, msg) {
|
|
133
|
+
try {
|
|
134
|
+
this.logger.log(loglevel, msg.payload.message, msg.payload.meta);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
this.error(error, msg);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
104
139
|
|
|
105
140
|
RED.nodes.registerType('elastic-search-logger', LogElasticLoggerNode, {
|
|
106
141
|
credentials: {
|
|
@@ -109,8 +144,4 @@ module.exports = function (RED) {
|
|
|
109
144
|
index: { type: 'text' },
|
|
110
145
|
},
|
|
111
146
|
});
|
|
112
|
-
|
|
113
|
-
LogElasticLoggerNode.prototype.addToLog = function addTolog(loglevel, msg) {
|
|
114
|
-
this.logger.log(loglevel, msg.payload.message, msg.payload.meta);
|
|
115
|
-
};
|
|
116
147
|
};
|
package/elastic-search.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = function (RED) {
|
|
|
10
10
|
RED.nodes.createNode(this, config);
|
|
11
11
|
const node = this;
|
|
12
12
|
|
|
13
|
-
this.on('input', function (msg
|
|
13
|
+
this.on('input', function (msg) {
|
|
14
14
|
node.logger = RED.nodes.getNode(config.logger);
|
|
15
15
|
|
|
16
16
|
let loglevel = config.loglevel || '';
|
|
@@ -34,10 +34,12 @@ module.exports = function (RED) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
try {
|
|
38
|
+
node.logger.addToLog(level, msg);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
node.error(err);
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
|
-
|
|
40
|
-
if (done) done();
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
|
package/package.json
CHANGED