-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlog-elk-logger.html
150 lines (141 loc) · 6.82 KB
/
log-elk-logger.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<script type="text/javascript">
RED.nodes.registerType('log-elk-logger',{
category: 'config',
credentials: {
username: {type:"text"},
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 }
},
label: function() { return this.name; },
oneditprepare: function () {
$("#node-config-input-logfile").on("change", function() {
if ($("#node-config-input-logfile").is(':checked')) {
$("#node-config-input-logfile").attr("file", "file");
$("#filefields").show();
} else {
$("#node-config-input-logfile").removeAttr("file");
$("#filefields").hide();
}
});
$("#node-config-input-logelk").on("change", function() {
if ($("#node-config-input-logelk").is(':checked')) {
$("#node-config-input-logelk").attr("file", "file");
$("#elkfields").show();
} else {
$("#node-config-input-logelk").removeAttr("file");
$("#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();
}
});
}
});
</script>
<script type="text/html" data-template-name="log-elk-logger">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name">
</div>
<div class="form-row">
<label><i class="fa fa-random"></i> Log output</span></label>
<input style="width:20px; vertical-align:baseline; margin-right:5px;" type="checkbox" id="node-config-input-logelk" autocomplete="off">
<label style="width:auto; margin-top:7px;" for="node-config-input-logelk"><span>ElasticSearch</span></label>
<br>
<label> </label>
<input style="width:20px; vertical-align:baseline; margin-right:5px;" type="checkbox" id="node-config-input-logloki" autocomplete="off">
<label style="width:auto; margin-top:7px;" for="node-config-input-logloki"><span>Loki</span></label>
<br>
<label> </label>
<input style="width:20px; vertical-align:baseline; margin-right:5px;" type="checkbox" id="node-config-input-logfile" autocomplete="off">
<label style="width:auto; margin-top:7px;" for="node-config-input-logfile"><span>File</span></label>
<br>
<label> </label>
<input style="width:20px; vertical-align:baseline; margin-right:5px;" type="checkbox" id="node-config-input-logconsole" autocomplete="off">
<label style="width:auto; margin-top:7px;" for="node-config-input-logconsole"><span>System Console</span></label>
<br>
<label> </label>
<input style="width:20px; vertical-align:baseline; margin-right:5px;" type="checkbox" id="node-config-input-logdebug" autocomplete="off">
<label style="width:auto; margin-top:7px;" for="node-config-input-logdebug"><span>Debug Window</span></label>
</div>
<div id="elkfields">
<div class="form-row">
<label style="width:100%;"><span>ElasticSearch options</span></label>
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-url"><i class="fa fa-plug"></i> Elastic URL</label>
<input type="text" id="node-config-input-url">
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-config-input-username">
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-password"><i class="fa fa-key"></i> Password</label>
<input type="password" id="node-config-input-password">
</div>
</div>
<div id="lokifields">
<div class="form-row">
<label style="width:100%;"><span>Loki options</span></label>
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-loki_url"><i class="fa fa-plug"></i> Loki URL</label>
<input type="text" id="node-config-input-loki_url">
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-loki_username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-config-input-loki_username">
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-loki_password"><i class="fa fa-key"></i> Password</label>
<input type="password" id="node-config-input-loki_password">
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-loki_app"><i class="fa fa-tag"></i> App Label</label>
<input type="text" id="node-config-input-loki_app">
</div>
</div>
<div id="filefields">
<div class="form-row">
<label style="width:100%;"><span>File options</span></label>
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-filename"><i class="fa fa-file"></i> Filename</label>
<input type="text" id="node-config-input-filename" placeholder="log-elk.log">
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-maxsize"><i class="fa fa-arrows-h"></i> File size</label>
<input type="number" id="node-config-input-maxsize" style="width:80px; height:25px;" min="1">
<span> Mb</span>
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-maxfiles"><i class="fa fa-files-o"></i> Max Files</label>
<input type="number" id="node-config-input-maxfiles" style="width:80px; height:25px;" placeholder="2">
</div>
</div>
</script>
<script type="text/x-red" data-help-name="log-elk-logger">
<p>The configuration for the log-elk logger</p>
</script>