1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.forgerock.audit.handlers.syslog;
17
18 import static java.util.Collections.unmodifiableMap;
19
20 import java.util.ArrayList;
21 import java.util.HashMap;
22 import java.util.List;
23 import java.util.Map;
24
25 import org.forgerock.audit.events.handlers.EventHandlerConfiguration;
26
27 import com.fasterxml.jackson.annotation.JsonProperty;
28 import com.fasterxml.jackson.annotation.JsonPropertyDescription;
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 public class SyslogAuditEventHandlerConfiguration extends EventHandlerConfiguration {
58
59 @JsonProperty(required = true)
60 @JsonPropertyDescription("audit.handlers.syslog.transportProtocol")
61 private TransportProtocol protocol;
62
63 @JsonProperty(required = true)
64 @JsonPropertyDescription("audit.handlers.syslog.host")
65 private String host;
66
67 @JsonProperty(required = true)
68 @JsonPropertyDescription("audit.handlers.syslog.port")
69 private int port;
70
71 @JsonPropertyDescription("audit.handlers.syslog.connectTimeout")
72 private int connectTimeout;
73
74 @JsonProperty(required = true)
75 @JsonPropertyDescription("audit.handlers.syslog.facility")
76 private Facility facility;
77
78 @JsonProperty
79 @JsonPropertyDescription("audit.handlers.syslog.severityFieldMappings")
80 private List<SeverityFieldMapping> severityFieldMappings = new ArrayList<>();
81
82
83 @JsonPropertyDescription("audit.handlers.syslog.buffering")
84 protected EventBufferingConfiguration buffering = new EventBufferingConfiguration();
85
86
87
88
89
90
91 public TransportProtocol getProtocol() {
92 return protocol;
93 }
94
95
96
97
98
99
100
101 public void setProtocol(TransportProtocol protocol) {
102 this.protocol = protocol;
103 }
104
105
106
107
108
109
110 public String getHost() {
111 return host;
112 }
113
114
115
116
117
118
119
120 public void setHost(String host) {
121 this.host = host;
122 }
123
124
125
126
127
128
129 public int getPort() {
130 return port;
131 }
132
133
134
135
136
137
138
139 public void setPort(int port) {
140 this.port = port;
141 }
142
143
144
145
146
147
148
149
150 public int getConnectTimeout() {
151 return connectTimeout;
152 }
153
154
155
156
157
158
159
160
161
162 public void setConnectTimeout(int connectTimeout) {
163 this.connectTimeout = connectTimeout;
164 }
165
166
167
168
169
170
171
172
173 public Facility getFacility() {
174 return facility;
175 }
176
177
178
179
180
181
182
183
184
185 public void setFacility(Facility facility) {
186 this.facility = facility;
187 }
188
189
190
191
192
193
194 public List<SeverityFieldMapping> getSeverityFieldMappings() {
195 return severityFieldMappings;
196 }
197
198
199
200
201
202
203
204 public void setSeverityFieldMappings(List<SeverityFieldMapping> severityFieldMappings) {
205 this.severityFieldMappings = severityFieldMappings;
206 }
207
208
209
210
211
212
213 public EventBufferingConfiguration getBuffering() {
214 return buffering;
215 }
216
217
218
219
220
221
222
223 public void setBufferingConfiguration(EventBufferingConfiguration bufferingConfiguration) {
224 this.buffering = bufferingConfiguration;
225 }
226
227 @Override
228 public boolean isUsableForQueries() {
229 return false;
230 }
231
232
233
234
235 public static final class SeverityFieldMapping {
236
237 @JsonProperty(required = true)
238 @JsonPropertyDescription("audit.handlers.syslog.severityFieldMapping.topic")
239 private String topic;
240
241 @JsonProperty(required = true)
242 @JsonPropertyDescription("audit.handlers.syslog.severityFieldMapping.field")
243 private String field;
244
245 @JsonProperty(required = true)
246 @JsonPropertyDescription("audit.handlers.syslog.severityFieldMapping.valueMappings")
247 private Map<String, Severity> valueMappings = new HashMap<>();
248
249
250
251
252
253
254 public String getTopic() {
255 return topic;
256 }
257
258
259
260
261
262
263
264 public void setTopic(String topic) {
265 this.topic = topic;
266 }
267
268
269
270
271
272
273
274
275 public String getField() {
276 return field;
277 }
278
279
280
281
282
283
284
285 public void setField(String field) {
286 this.field = field;
287 }
288
289
290
291
292
293
294 public Map<String, Severity> getValueMappings() {
295 return unmodifiableMap(valueMappings);
296 }
297
298
299
300
301
302
303
304 public void setValueMappings(Map<String, Severity> valueMappings) {
305 this.valueMappings = new HashMap<>(valueMappings);
306 }
307 }
308
309
310
311
312 public static class EventBufferingConfiguration {
313
314 @JsonPropertyDescription("audit.handlers.syslog.buffering.enabled")
315 private boolean enabled;
316
317 @JsonPropertyDescription("audit.handlers.syslog.buffering.maxSize")
318 private int maxSize = 5000;
319
320
321
322
323
324
325 public boolean isEnabled() {
326 return enabled;
327 }
328
329
330
331
332
333
334
335 public void setEnabled(boolean enabled) {
336 this.enabled = enabled;
337 }
338
339 }
340 }