Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/docs/dellemc.enterprise_sonic.sonic_logging_module.rst

raw
1 .. _dellemc.enterprise_sonic.sonic_logging_module:
2
3
4 **************************************
5 dellemc.enterprise_sonic.sonic_logging
6 **************************************
7
8 **Manage logging configuration on SONiC.**
9
10
11 Version added: 2.1.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module provides configuration management of logging for devices running SONiC.
21
22
23
24
25 Parameters
26 ----------
27
28 .. raw:: html
29
30 <table border=0 cellpadding=0 class="documentation-table">
31 <tr>
32 <th colspan="3">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="3">
38 <div class="ansibleOptionAnchor" id="parameter-"></div>
39 <b>config</b>
40 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
41 <div style="font-size: small">
42 <span style="color: purple">dictionary</span>
43 </div>
44 </td>
45 <td>
46 </td>
47 <td>
48 <div>Specifies logging related configurations.</div>
49 </td>
50 </tr>
51 <tr>
52 <td class="elbow-placeholder"></td>
53 <td colspan="2">
54 <div class="ansibleOptionAnchor" id="parameter-"></div>
55 <b>remote_servers</b>
56 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
57 <div style="font-size: small">
58 <span style="color: purple">list</span>
59 / <span style="color: purple">elements=dictionary</span>
60 </div>
61 </td>
62 <td>
63 </td>
64 <td>
65 <div>Remote logging sever configuration.</div>
66 </td>
67 </tr>
68 <tr>
69 <td class="elbow-placeholder"></td>
70 <td class="elbow-placeholder"></td>
71 <td colspan="1">
72 <div class="ansibleOptionAnchor" id="parameter-"></div>
73 <b>host</b>
74 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
75 <div style="font-size: small">
76 <span style="color: purple">string</span>
77 / <span style="color: red">required</span>
78 </div>
79 </td>
80 <td>
81 </td>
82 <td>
83 <div>IPv4/IPv6 address or host name of the remote logging server.</div>
84 </td>
85 </tr>
86 <tr>
87 <td class="elbow-placeholder"></td>
88 <td class="elbow-placeholder"></td>
89 <td colspan="1">
90 <div class="ansibleOptionAnchor" id="parameter-"></div>
91 <b>message_type</b>
92 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
93 <div style="font-size: small">
94 <span style="color: purple">string</span>
95 </div>
96 </td>
97 <td>
98 <ul style="margin: 0; padding: 0"><b>Choices:</b>
99 <li>log</li>
100 <li>event</li>
101 <li>audit</li>
102 <li>auditd-system</li>
103 </ul>
104 </td>
105 <td>
106 <div>Type of messages that remote server receives. Defaults to &quot;log&quot; value.</div>
107 </td>
108 </tr>
109 <tr>
110 <td class="elbow-placeholder"></td>
111 <td class="elbow-placeholder"></td>
112 <td colspan="1">
113 <div class="ansibleOptionAnchor" id="parameter-"></div>
114 <b>protocol</b>
115 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
116 <div style="font-size: small">
117 <span style="color: purple">string</span>
118 </div>
119 </td>
120 <td>
121 <ul style="margin: 0; padding: 0"><b>Choices:</b>
122 <li>TCP</li>
123 <li>TLS</li>
124 <li>UDP</li>
125 </ul>
126 </td>
127 <td>
128 <div>Type of the protocol for sending the messages. Defaults to &quot;UDP&quot; value.</div>
129 </td>
130 </tr>
131 <tr>
132 <td class="elbow-placeholder"></td>
133 <td class="elbow-placeholder"></td>
134 <td colspan="1">
135 <div class="ansibleOptionAnchor" id="parameter-"></div>
136 <b>remote_port</b>
137 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
138 <div style="font-size: small">
139 <span style="color: purple">integer</span>
140 </div>
141 </td>
142 <td>
143 </td>
144 <td>
145 <div>Destination port number for logging messages sent to the server.</div>
146 </td>
147 </tr>
148 <tr>
149 <td class="elbow-placeholder"></td>
150 <td class="elbow-placeholder"></td>
151 <td colspan="1">
152 <div class="ansibleOptionAnchor" id="parameter-"></div>
153 <b>severity</b>
154 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
155 <div style="font-size: small">
156 <span style="color: purple">string</span>
157 </div>
158 <div style="font-style: italic; font-size: small; color: darkgreen">added in 3.1.0</div>
159 </td>
160 <td>
161 <ul style="margin: 0; padding: 0"><b>Choices:</b>
162 <li>debug</li>
163 <li>info</li>
164 <li>notice</li>
165 <li>warning</li>
166 <li>error</li>
167 <li>critical</li>
168 <li>alert</li>
169 <li>emergency</li>
170 </ul>
171 </td>
172 <td>
173 <div>The log severity filter for remote syslog server. Defaults to &quot;notice&quot; value.</div>
174 </td>
175 </tr>
176 <tr>
177 <td class="elbow-placeholder"></td>
178 <td class="elbow-placeholder"></td>
179 <td colspan="1">
180 <div class="ansibleOptionAnchor" id="parameter-"></div>
181 <b>source_interface</b>
182 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
183 <div style="font-size: small">
184 <span style="color: purple">string</span>
185 </div>
186 </td>
187 <td>
188 </td>
189 <td>
190 <div>Source interface used as source ip for sending logging packets.</div>
191 </td>
192 </tr>
193 <tr>
194 <td class="elbow-placeholder"></td>
195 <td class="elbow-placeholder"></td>
196 <td colspan="1">
197 <div class="ansibleOptionAnchor" id="parameter-"></div>
198 <b>vrf</b>
199 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
200 <div style="font-size: small">
201 <span style="color: purple">string</span>
202 </div>
203 </td>
204 <td>
205 </td>
206 <td>
207 <div>VRF name used by remote logging server.</div>
208 </td>
209 </tr>
210
211 <tr>
212 <td class="elbow-placeholder"></td>
213 <td colspan="2">
214 <div class="ansibleOptionAnchor" id="parameter-"></div>
215 <b>security_profile</b>
216 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
217 <div style="font-size: small">
218 <span style="color: purple">string</span>
219 </div>
220 <div style="font-style: italic; font-size: small; color: darkgreen">added in 3.1.0</div>
221 </td>
222 <td>
223 </td>
224 <td>
225 <div>Specifies the security profile name for the global syslog settings.</div>
226 </td>
227 </tr>
228
229 <tr>
230 <td colspan="3">
231 <div class="ansibleOptionAnchor" id="parameter-"></div>
232 <b>state</b>
233 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
234 <div style="font-size: small">
235 <span style="color: purple">string</span>
236 </div>
237 </td>
238 <td>
239 <ul style="margin: 0; padding: 0"><b>Choices:</b>
240 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
241 <li>replaced</li>
242 <li>overridden</li>
243 <li>deleted</li>
244 </ul>
245 </td>
246 <td>
247 <div>The state of the configuration after module completion.</div>
248 </td>
249 </tr>
250 </table>
251 <br/>
252
253
254 Notes
255 -----
256
257 .. note::
258 - Supports ``check_mode``.
259
260
261
262 Examples
263 --------
264
265 .. code-block:: yaml
266
267 # Using "deleted" state
268 #
269 # Before state:
270 # -------------
271 #
272 # sonic# show logging servers
273 # ----------------------------------------------------------------------------------------------------------
274 # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL
275 # ----------------------------------------------------------------------------------------------------------
276 # 10.11.0.2 5 Ethernet24 - event notice udp
277 # 10.11.1.1 616 Ethernet8 - log alert tcp
278 # log1.dell.com 6 Ethernet28 - audit notice udp
279 # 10.11.1.2 116 Ethernet6 - log notice tls
280 #
281 # sonic# show running-configuration | grep logging
282 # !
283 # logging security-profile default
284 # !
285
286 - name: Delete logging server configuration
287 sonic_logging:
288 config:
289 remote_servers:
290 - host: 10.11.0.2
291 - host: log1.dell.com
292 - host: 10.11.1.1
293 message_type: log
294 protocol: tcp
295 source_interface: Ethernet8
296 severity: alert
297 security_profile: "default"
298 state: deleted
299
300 # After state:
301 # ------------
302 #
303 # sonic# show logging servers
304 # ----------------------------------------------------------------------------------------------------------
305 # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL
306 # ----------------------------------------------------------------------------------------------------------
307 # 10.11.1.1 616 - - log notice udp
308 # 10.11.1.2 116 Ethernet6 - log notice tls
309 #
310 # sonic# show running-configuration | grep logging
311 # sonic#
312 #
313 # Using "merged" state
314 #
315 # Before state:
316 # -------------
317 #
318 # sonic# show logging servers
319 # ----------------------------------------------------------------------------------------------------------
320 # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL
321 # ----------------------------------------------------------------------------------------------------------
322 # 10.11.1.1 616 Ethernet8 - log notice tcp
323 #
324 # sonic# show running-configuration | grep logging
325 # sonic#
326 - name: Merge logging server configuration
327 sonic_logging:
328 config:
329 remote_servers:
330 - host: 10.11.0.2
331 remote_port: 5
332 protocol: TCP
333 source_interface: Ethernet24
334 message_type: event
335 - host: 10.11.0.1
336 remote_port: 4
337 protocol: TLS
338 source_interface: Ethernet2
339 - host: 10.11.1.1
340 severity: error
341 - host: log1.dell.com
342 remote_port: 6
343 protocol: udp
344 source_interface: Ethernet28
345 message_type: audit
346 security_profile: "default"
347 state: merged
348
349 # After state:
350 # ------------
351 # sonic# show logging servers
352 # ----------------------------------------------------------------------------------------------------------
353 # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL
354 # ----------------------------------------------------------------------------------------------------------
355 # 10.11.0.2 5 Ethernet24 - event notice udp
356 # 10.11.0.1 4 Ethernet2 - log notice tls
357 # 10.11.1.1 616 Ethernet8 - log error tcp
358 # log1.dell.com 6 Ethernet28 - audit notice udp
359 # sonic# show running-configuration | grep logging
360 # !
361 # logging security-profile default
362 # !
363 #
364 #
365 # Using "overridden" state
366 #
367 # Before state:
368 # -------------
369 #
370 # sonic# show logging servers
371 # ----------------------------------------------------------------------------------------------------------
372 # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL
373 # ----------------------------------------------------------------------------------------------------------
374 # 10.11.1.1 616 Ethernet8 - log notice tcp
375 # 10.11.1.2 626 Ethernet16 - event emergency udp
376 # 10.11.1.3 626 Ethernet14 - log notice tls
377 #
378 # sonic# show running-configuration | grep logging
379 # !
380 # logging security-profile default
381 # !
382 - name: Override logging server configuration
383 sonic_logging:
384 config:
385 remote_servers:
386 - host: 10.11.1.2
387 remote_port: 622
388 protocol: TCP
389 source_interface: Ethernet24
390 message_type: audit
391 severity: alert
392 state: overridden
393 #
394 # After state:
395 # ------------
396 # sonic# show logging servers
397 # ----------------------------------------------------------------------------------------------------------
398 # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL
399 # ----------------------------------------------------------------------------------------------------------
400 # 10.11.1.2 622 Ethernet24 - audit alert tcp
401 # sonic# show running-configuration | grep logging
402 # sonic#
403 #
404 # Using "replaced" state
405 #
406 # Before state:
407 # -------------
408 #
409 # sonic# show logging servers
410 # ----------------------------------------------------------------------------------------------------------
411 # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL
412 # ----------------------------------------------------------------------------------------------------------
413 # 10.11.1.1 616 Ethernet8 - log notice tcp
414 # 10.11.1.2 626 Ethernet16 - event notice udp
415 #
416 # sonic# show running-configuration | grep logging
417 # sonic#
418 - name: Replace logging server configuration
419 sonic_logging:
420 config:
421 remote_servers:
422 - host: 10.11.1.2
423 remote_port: 622
424 protocol: UDP
425 message_type: audit
426 severity: debug
427 security_profile: "default"
428 state: replaced
429 #
430 # After state:
431 # ------------
432 #
433 # "MESSAGE-TYPE" has default value of "log"
434 #
435 # ----------------------------------------------------------------------------------------------------------
436 # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL
437 # ----------------------------------------------------------------------------------------------------------
438 # 10.11.1.1 616 Ethernet8 - log notice tcp
439 # 10.11.1.2 622 - - audit debug udp
440 # sonic# show running-configuration | grep logging
441 # !
442 # logging security-profile default
443 # !
444 #
445
446
447
448 Return Values
449 -------------
450 Common return values are documented `here <https://docs.ansible.com/projects/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
451
452 .. raw:: html
453
454 <table border=0 cellpadding=0 class="documentation-table">
455 <tr>
456 <th colspan="1">Key</th>
457 <th>Returned</th>
458 <th width="100%">Description</th>
459 </tr>
460 <tr>
461 <td colspan="1">
462 <div class="ansibleOptionAnchor" id="return-"></div>
463 <b>after</b>
464 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
465 <div style="font-size: small">
466 <span style="color: purple">list</span>
467 </div>
468 </td>
469 <td>when changed</td>
470 <td>
471 <div>The resulting configuration module invocation.</div>
472 <br/>
473 <div style="font-size: smaller"><b>Sample:</b></div>
474 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
475 </td>
476 </tr>
477 <tr>
478 <td colspan="1">
479 <div class="ansibleOptionAnchor" id="return-"></div>
480 <b>after_generated</b>
481 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
482 <div style="font-size: small">
483 <span style="color: purple">list</span>
484 </div>
485 </td>
486 <td>when <code>check_mode</code></td>
487 <td>
488 <div>The generated configuration module invocation.</div>
489 <br/>
490 <div style="font-size: smaller"><b>Sample:</b></div>
491 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
492 </td>
493 </tr>
494 <tr>
495 <td colspan="1">
496 <div class="ansibleOptionAnchor" id="return-"></div>
497 <b>before</b>
498 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
499 <div style="font-size: small">
500 <span style="color: purple">list</span>
501 </div>
502 </td>
503 <td>always</td>
504 <td>
505 <div>The configuration prior to the module invocation.</div>
506 <br/>
507 <div style="font-size: smaller"><b>Sample:</b></div>
508 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format as the parameters above.</div>
509 </td>
510 </tr>
511 <tr>
512 <td colspan="1">
513 <div class="ansibleOptionAnchor" id="return-"></div>
514 <b>commands</b>
515 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
516 <div style="font-size: small">
517 <span style="color: purple">list</span>
518 </div>
519 </td>
520 <td>always</td>
521 <td>
522 <div>The set of commands pushed to the remote device.</div>
523 <br/>
524 <div style="font-size: smaller"><b>Sample:</b></div>
525 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;command 1&#x27;, &#x27;command 2&#x27;, &#x27;command 3&#x27;]</div>
526 </td>
527 </tr>
528 </table>
529 <br/><br/>
530
531
532 Status
533 ------
534
535
536 Authors
537 ~~~~~~~
538
539 - M\. Zhang (@mingjunzhang2019)