-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnxlog.conf
178 lines (167 loc) · 4.86 KB
/
nxlog.conf
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
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
User nxlog
Group nxlog
define LOGFILE /var/log/nxlog/nxlog.log
LogFile %LOGFILE%
LogLevel INFO
define ABGAPREF /var/log/xcoder/abga
<Extension csv>
Module xm_csv
Fields $ts, $SourceModuleName, $raw_event
QuoteMethod None
Delimiter ,
</Extension>
<Extension fileop>
Module xm_fileop
<Schedule>
When 15 6 * * *
Exec file_cycle('%LOGFILE%', 6);
</Schedule>
</Extension>
<Input 6514>
Module im_tcp
Port 6514
Exec create_stat('6514_rate', 'RATE', 2);\
add_stat('6514_rate', 1);
Exec if $raw_event =~ /audiobargraph_v-alarm ([01])$/ {\
$silence = integer($1);\
create_stat('6514_silence', 'AVG', 10);\
add_stat('6514_silence', $silence);\
}
<Schedule>
Every 5 sec
Exec if not defined get_stat('6514_rate') {\
create_stat('6514_rate', 'RATE', 2);\
add_stat('6514_rate', 0);\
}\
file_truncate("%ABGAPREF%.6514.rate");\
file_write("%ABGAPREF%.6514.rate", string(get_stat('6514_rate')));
</Schedule>
<Schedule>
Every 10 sec
Exec if get_stat('6514_rate') != 0 {\
if not defined get_stat('6514_silence') \
create_stat('6514_silence', 'AVG', 10);\
file_truncate("%ABGAPREF%.6514.silence");\
if get_stat('6514_silence') > 0 \
set_var("6514_silence_abs", "1");\
else \
set_var("6514_silence_abs", "0");\
file_write("%ABGAPREF%.6514.silence", get_var('6514_silence_abs'));\
}
</Schedule>
</Input>
<Input 6515>
Module im_tcp
Port 6515
Exec create_stat('6515_rate', 'RATE', 2);\
add_stat('6515_rate', 1);
Exec if $raw_event =~ /audiobargraph_v-alarm ([01])$/ {\
$silence = integer($1);\
create_stat('6515_silence', 'AVG', 10);\
add_stat('6515_silence', $silence);\
}
<Schedule>
Every 5 sec
Exec if not defined get_stat('6515_rate') {\
create_stat('6515_rate', 'RATE', 2);\
add_stat('6515_rate', 0);\
}\
file_truncate("%ABGAPREF%.6515.rate");\
file_write("%ABGAPREF%.6515.rate", string(get_stat('6515_rate')));
</Schedule>
<Schedule>
Every 10 sec
Exec if get_stat('6515_rate') != 0 {\
if not defined get_stat('6515_silence') \
create_stat('6515_silence', 'AVG', 10);\
file_truncate("%ABGAPREF%.6515.silence");\
if get_stat('6515_silence') > 0 \
set_var("6515_silence_abs", "1");\
else \
set_var("6515_silence_abs", "0");\
file_write("%ABGAPREF%.6515.silence", get_var('6515_silence_abs'));\
}
</Schedule>
</Input>
<Input 6516>
Module im_tcp
Port 6516
Exec create_stat('6516_rate', 'RATE', 2);\
add_stat('6516_rate', 1);
Exec if $raw_event =~ /audiobargraph_v-alarm ([01])$/ {\
$silence = integer($1);\
create_stat('6516_silence', 'AVG', 10);\
add_stat('6516_silence', $silence);\
}
<Schedule>
Every 5 sec
Exec if not defined get_stat('6516_rate') {\
create_stat('6516_rate', 'RATE', 2);\
add_stat('6516_rate', 0);\
}\
file_truncate("%ABGAPREF%.6516.rate");\
file_write("%ABGAPREF%.6516.rate", string(get_stat('6516_rate')));
</Schedule>
<Schedule>
Every 10 sec
Exec if get_stat('6516_rate') != 0 {\
if not defined get_stat('6516_silence') \
create_stat('6516_silence', 'AVG', 10);\
file_truncate("%ABGAPREF%.6516.silence");\
if get_stat('6516_silence') > 0 \
set_var("6516_silence_abs", "1");\
else \
set_var("6516_silence_abs", "0");\
file_write("%ABGAPREF%.6516.silence", get_var('6516_silence_abs'));\
}
</Schedule>
</Input>
<Input 6517>
Module im_tcp
Port 6517
Exec create_stat('6517_rate', 'RATE', 2);\
add_stat('6517_rate', 1);
Exec if $raw_event =~ /audiobargraph_v-alarm ([01])$/ {\
$silence = integer($1);\
create_stat('6517_silence', 'AVG', 10);\
add_stat('6517_silence', $silence);\
}
<Schedule>
Every 5 sec
Exec if not defined get_stat('6517_rate') {\
create_stat('6517_rate', 'RATE', 2);\
add_stat('6517_rate', 0);\
}\
file_truncate("%ABGAPREF%.6517.rate");\
file_write("%ABGAPREF%.6517.rate", string(get_stat('6517_rate')));
</Schedule>
<Schedule>
Every 10 sec
Exec if get_stat('6517_rate') != 0 {\
if not defined get_stat('6517_silence') \
create_stat('6517_silence', 'AVG', 10);\
file_truncate("%ABGAPREF%.6517.silence");\
if get_stat('6517_silence') > 0 \
set_var("6517_silence_abs", "1");\
else \
set_var("6517_silence_abs", "0");\
file_write("%ABGAPREF%.6517.silence", get_var('6517_silence_abs'));\
}
</Schedule>
</Input>
<Output o>
Module om_file
File "%ABGAPREF%.log"
Exec if o->file_size() >= 5M {\
file_cycle("%ABGAPREF%.log", 1);\
o->reopen();\
}
</Output>
<Processor abga2csv>
Module pm_null
Exec $ts = strftime($EventReceivedTime, "%s");
Exec $raw_event = csv->to_csv();
</Processor>
<Route abga>
Path 6514, 6515, 6516, 6517 => abga2csv => o
</Route>