-
Notifications
You must be signed in to change notification settings - Fork 0
/
elastic-search-logger.html
106 lines (101 loc) · 4.06 KB
/
elastic-search-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
<script type="text/javascript">
RED.nodes.registerType('elastic-search-logger', {
category: 'config',
credentials: {
username: { type: 'text' },
password: { type: 'password' },
index: { type: 'text' },
},
defaults: {
name: { value: '' },
url: { value: 'http://localhost:9200' },
urlType: { value: 'str' },
usernameType: { value: 'str' },
passwordType: { value: 'str' },
indexType: { value: 'str' },
filename: { value: 'log-elastic.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;
},
},
},
label: function () {
return this.name;
},
oneditprepare: function () {
// URL
$('#node-config-input-url').typedInput({
type: this.urlType,
types: ['str', 'env'],
typeField: '#node-config-input-urlType',
value: this.url,
});
// Username
$('#node-config-input-username').typedInput({
type: this.usernameType,
types: ['str', 'cred', 'env'],
typeField: '#node-config-input-usernameType',
value: this.credentials.username,
});
// Password
$('#node-config-input-password').typedInput({
type: this.passwordType,
types: ['str', 'cred', 'env'],
typeField: '#node-config-input-passwordType',
value: this.credentials.password,
});
// Index
$('#node-config-input-index').typedInput({
type: this.indexType,
types: ['str', 'env'],
typeField: '#node-config-input-indexType',
value: this.credentials.index,
});
},
});
</script>
<script type="text/html" data-template-name="elastic-search-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 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" />
<input type="hidden" id="node-config-input-urlType" />
</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" />
<input type="hidden" id="node-config-input-usernameType" />
</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="text" id="node-config-input-password" />
<input type="hidden" id="node-config-input-passwordType" />
</div>
<div class="form-row" style="padding-left:20px;">
<label for="node-config-input-index"><i class="fa fa-tag"></i> Index</label>
<input type="text" id="node-config-input-index" />
<input type="hidden" id="node-config-input-indexType" />
</div>
</div>
</script>
<script type="text/x-red" data-help-name="elastic-search-logger">
<p>The configuration for the elastic-search-logger.</p>
<p>Configurations like the requested URL to Elastic, Username & Password and the Elastic Index.</p>
</script>