3 * Copyright (C) 2019 Cumulus Networks, Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "lib/log_vty.h"
26 #include "lib/zlog_targets.h"
27 #include "lib/lib_errors.h"
28 #include "lib/printfrr.h"
30 #ifndef VTYSH_EXTRACT_PL
31 #include "lib/log_vty_clippy.c"
34 #define ZLOG_MAXLVL(a, b) MAX(a, b)
36 DEFINE_HOOK(zlog_rotate
, (), ());
37 DEFINE_HOOK(zlog_cli_show
, (struct vty
* vty
), (vty
));
39 static unsigned logmsgs_with_persist_bt
;
41 static const int log_default_lvl
= LOG_DEBUG
;
43 static int log_config_stdout_lvl
= ZLOG_DISABLED
;
44 static int log_config_syslog_lvl
= ZLOG_DISABLED
;
45 static int log_cmdline_stdout_lvl
= ZLOG_DISABLED
;
46 static int log_cmdline_syslog_lvl
= ZLOG_DISABLED
;
48 static struct zlog_cfg_file zt_file_cmdline
= {
49 .prio_min
= ZLOG_DISABLED
,
51 static struct zlog_cfg_file zt_file
= {
52 .prio_min
= ZLOG_DISABLED
,
54 static struct zlog_cfg_file zt_stdout
= {
55 .prio_min
= ZLOG_DISABLED
,
57 static struct zlog_cfg_filterfile zt_filterfile
= {
59 .prio_min
= ZLOG_DISABLED
,
63 const char *zlog_progname
;
64 static const char *zlog_protoname
;
66 static const struct facility_map
{
70 } syslog_facilities
[] = {
71 {LOG_KERN
, "kern", 1},
72 {LOG_USER
, "user", 2},
73 {LOG_MAIL
, "mail", 1},
74 {LOG_DAEMON
, "daemon", 1},
75 {LOG_AUTH
, "auth", 1},
76 {LOG_SYSLOG
, "syslog", 1},
78 {LOG_NEWS
, "news", 1},
79 {LOG_UUCP
, "uucp", 2},
80 {LOG_CRON
, "cron", 1},
84 {LOG_LOCAL0
, "local0", 6},
85 {LOG_LOCAL1
, "local1", 6},
86 {LOG_LOCAL2
, "local2", 6},
87 {LOG_LOCAL3
, "local3", 6},
88 {LOG_LOCAL4
, "local4", 6},
89 {LOG_LOCAL5
, "local5", 6},
90 {LOG_LOCAL6
, "local6", 6},
91 {LOG_LOCAL7
, "local7", 6},
95 static const char * const zlog_priority
[] = {
96 "emergencies", "alerts", "critical", "errors", "warnings",
97 "notifications", "informational", "debugging", NULL
,
100 const char *zlog_priority_str(int priority
)
102 if (priority
> LOG_DEBUG
)
104 return zlog_priority
[priority
];
107 const char *facility_name(int facility
)
109 const struct facility_map
*fm
;
111 for (fm
= syslog_facilities
; fm
->name
; fm
++)
112 if (fm
->facility
== facility
)
117 int facility_match(const char *str
)
119 const struct facility_map
*fm
;
121 for (fm
= syslog_facilities
; fm
->name
; fm
++)
122 if (!strncmp(str
, fm
->name
, fm
->match
))
127 int log_level_match(const char *s
)
131 for (level
= 0; zlog_priority
[level
] != NULL
; level
++)
132 if (!strncmp(s
, zlog_priority
[level
], 2))
134 return ZLOG_DISABLED
;
137 void zlog_rotate(void)
139 zlog_file_rotate(&zt_file
);
140 zlog_file_rotate(&zt_filterfile
.parent
);
141 hook_call(zlog_rotate
);
145 void log_show_syslog(struct vty
*vty
)
147 int level
= zlog_syslog_get_prio_min();
149 vty_out(vty
, "Syslog logging: ");
150 if (level
== ZLOG_DISABLED
)
151 vty_out(vty
, "disabled\n");
153 vty_out(vty
, "level %s, facility %s, ident %s\n",
154 zlog_priority
[level
],
155 facility_name(zlog_syslog_get_facility()),
159 DEFUN_NOSH (show_logging
,
163 "Show current logging configuration\n")
165 log_show_syslog(vty
);
167 vty_out(vty
, "Stdout logging: ");
168 if (zt_stdout
.prio_min
== ZLOG_DISABLED
)
169 vty_out(vty
, "disabled");
171 vty_out(vty
, "level %s",
172 zlog_priority
[zt_stdout
.prio_min
]);
175 vty_out(vty
, "File logging: ");
176 if (zt_file
.prio_min
== ZLOG_DISABLED
|| !zt_file
.filename
)
177 vty_out(vty
, "disabled");
179 vty_out(vty
, "level %s, filename %s",
180 zlog_priority
[zt_file
.prio_min
], zt_file
.filename
);
183 if (zt_filterfile
.parent
.prio_min
!= ZLOG_DISABLED
184 && zt_filterfile
.parent
.filename
)
185 vty_out(vty
, "Filtered-file logging: level %s, filename %s\n",
186 zlog_priority
[zt_filterfile
.parent
.prio_min
],
187 zt_filterfile
.parent
.filename
);
189 if (log_cmdline_syslog_lvl
!= ZLOG_DISABLED
)
191 "From command line: \"--log syslog --log-level %s\"\n",
192 zlog_priority
[log_cmdline_syslog_lvl
]);
193 if (log_cmdline_stdout_lvl
!= ZLOG_DISABLED
)
195 "From command line: \"--log stdout --log-level %s\"\n",
196 zlog_priority
[log_cmdline_stdout_lvl
]);
197 if (zt_file_cmdline
.prio_min
!= ZLOG_DISABLED
)
199 "From command line: \"--log file:%s --log-level %s\"\n",
200 zt_file_cmdline
.filename
,
201 zlog_priority
[zt_file_cmdline
.prio_min
]);
203 vty_out(vty
, "Protocol name: %s\n", zlog_protoname
);
204 vty_out(vty
, "Record priority: %s\n",
205 (zt_file
.record_priority
? "enabled" : "disabled"));
206 vty_out(vty
, "Timestamp precision: %d\n", zt_file
.ts_subsec
);
208 hook_call(zlog_cli_show
, vty
);
212 DEFPY (config_log_stdout
,
213 config_log_stdout_cmd
,
214 "log stdout [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>$levelarg]",
216 "Set stdout logging level\n"
222 level
= log_level_match(levelarg
);
223 if (level
== ZLOG_DISABLED
)
224 return CMD_ERR_NO_MATCH
;
226 level
= log_default_lvl
;
228 log_config_stdout_lvl
= level
;
229 zt_stdout
.prio_min
= ZLOG_MAXLVL(log_config_stdout_lvl
,
230 log_cmdline_stdout_lvl
);
231 zlog_file_set_other(&zt_stdout
);
235 DEFUN (no_config_log_stdout
,
236 no_config_log_stdout_cmd
,
237 "no log stdout [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
240 "Cancel logging to stdout\n"
243 log_config_stdout_lvl
= ZLOG_DISABLED
;
244 zt_stdout
.prio_min
= ZLOG_MAXLVL(log_config_stdout_lvl
,
245 log_cmdline_stdout_lvl
);
246 zlog_file_set_other(&zt_stdout
);
250 DEFUN_HIDDEN (config_log_monitor
,
251 config_log_monitor_cmd
,
252 "log monitor [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
254 "Set terminal line (monitor) logging level\n"
257 vty_out(vty
, "%% \"log monitor\" is deprecated and does nothing.\n");
261 DEFUN_HIDDEN (no_config_log_monitor
,
262 no_config_log_monitor_cmd
,
263 "no log monitor [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
266 "Disable terminal line (monitor) logging\n"
272 DEFPY (debug_uid_backtrace
,
273 debug_uid_backtrace_cmd
,
274 "[no] debug unique-id UID backtrace",
277 "Options per individual log message, by unique ID\n"
278 "Log message unique ID (XXXXX-XXXXX)\n"
279 "Add backtrace to log when message is printed\n")
281 struct xrefdata search
, *xrd
;
282 struct xrefdata_logmsg
*xrdl
;
285 strlcpy(search
.uid
, uid
, sizeof(search
.uid
));
286 xrd
= xrefdata_uid_find(&xrefdata_uid
, &search
);
289 vty_out(vty
, "%% no log message with ID \"%s\" found\n", uid
);
292 if (xrd
->xref
->type
!= XREFT_LOGMSG
) {
293 vty_out(vty
, "%% ID \"%s\" is not a log message\n", uid
);
296 xrdl
= container_of(xrd
, struct xrefdata_logmsg
, xrefdata
);
298 flag
= (vty
->node
== CONFIG_NODE
) ? LOGMSG_FLAG_PERSISTENT
299 : LOGMSG_FLAG_EPHEMERAL
;
301 if ((xrdl
->fl_print_bt
& flag
) == (no
? 0 : flag
))
303 if (flag
== LOGMSG_FLAG_PERSISTENT
)
304 logmsgs_with_persist_bt
+= no
? -1 : 1;
306 xrdl
->fl_print_bt
^= flag
;
310 static int set_log_file(struct zlog_cfg_file
*target
, struct vty
*vty
,
311 const char *fname
, int loglevel
)
313 char path
[MAXPATHLEN
+ 1];
314 const char *fullpath
;
318 /* Path detection. */
319 if (!IS_DIRECTORY_SEP(*fname
)) {
320 char cwd
[MAXPATHLEN
+ 1];
322 cwd
[MAXPATHLEN
] = '\0';
324 if (getcwd(cwd
, MAXPATHLEN
) == NULL
) {
325 flog_err_sys(EC_LIB_SYSTEM_CALL
,
326 "config_log_file: Unable to alloc mem!");
327 return CMD_WARNING_CONFIG_FAILED
;
330 int pr
= snprintf(path
, sizeof(path
), "%s/%s", cwd
, fname
);
331 if (pr
< 0 || (unsigned int)pr
>= sizeof(path
)) {
334 "%s: Path too long ('%s/%s'); system maximum is %u",
335 __func__
, cwd
, fname
, MAXPATHLEN
);
336 return CMD_WARNING_CONFIG_FAILED
;
343 target
->prio_min
= loglevel
;
344 ok
= zlog_file_set_filename(target
, fullpath
);
348 vty_out(vty
, "can't open logfile %s\n", fname
);
349 return CMD_WARNING_CONFIG_FAILED
;
354 void command_setup_early_logging(const char *dest
, const char *level
)
362 nlevel
= log_level_match(level
);
364 if (nlevel
== ZLOG_DISABLED
) {
365 fprintf(stderr
, "invalid log level \"%s\"\n", level
);
369 nlevel
= log_default_lvl
;
374 sep
= strchr(dest
, ':');
375 len
= sep
? (int)(sep
- dest
) : (int)strlen(dest
);
377 snprintfrr(type
, sizeof(type
), "%.*s", len
, dest
);
379 if (strcmp(type
, "stdout") == 0) {
380 log_cmdline_stdout_lvl
= nlevel
;
381 zt_stdout
.prio_min
= ZLOG_MAXLVL(log_config_stdout_lvl
,
382 log_cmdline_stdout_lvl
);
383 zlog_file_set_other(&zt_stdout
);
386 if (strcmp(type
, "syslog") == 0) {
387 log_cmdline_syslog_lvl
= nlevel
;
388 zlog_syslog_set_prio_min(ZLOG_MAXLVL(log_config_syslog_lvl
,
389 log_cmdline_syslog_lvl
));
392 if (strcmp(type
, "file") == 0 && sep
) {
394 set_log_file(&zt_file_cmdline
, NULL
, sep
, nlevel
);
398 fprintf(stderr
, "invalid log target \"%s\" (\"%s\")\n", type
, dest
);
402 DEFUN (clear_log_cmdline
,
403 clear_log_cmdline_cmd
,
404 "clear log cmdline-targets",
407 "Disable log targets specified at startup by --log option\n")
409 zt_file_cmdline
.prio_min
= ZLOG_DISABLED
;
410 zlog_file_set_other(&zt_file_cmdline
);
412 log_cmdline_syslog_lvl
= ZLOG_DISABLED
;
413 zlog_syslog_set_prio_min(ZLOG_MAXLVL(log_config_syslog_lvl
,
414 log_cmdline_syslog_lvl
));
416 log_cmdline_stdout_lvl
= ZLOG_DISABLED
;
417 zt_stdout
.prio_min
= ZLOG_MAXLVL(log_config_stdout_lvl
,
418 log_cmdline_stdout_lvl
);
419 zlog_file_set_other(&zt_stdout
);
424 DEFPY (config_log_file
,
426 "log file FILENAME [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>$levelarg]",
432 int level
= log_default_lvl
;
435 level
= log_level_match(levelarg
);
436 if (level
== ZLOG_DISABLED
)
437 return CMD_ERR_NO_MATCH
;
439 return set_log_file(&zt_file
, vty
, filename
, level
);
442 DEFUN (no_config_log_file
,
443 no_config_log_file_cmd
,
444 "no log file [FILENAME [LEVEL]]",
447 "Cancel logging to file\n"
448 "Logging file name\n"
451 zt_file
.prio_min
= ZLOG_DISABLED
;
452 zlog_file_set_other(&zt_file
);
456 DEFPY (config_log_syslog
,
457 config_log_syslog_cmd
,
458 "log syslog [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>$levelarg]",
460 "Set syslog logging level\n"
466 level
= log_level_match(levelarg
);
468 if (level
== ZLOG_DISABLED
)
469 return CMD_ERR_NO_MATCH
;
471 level
= log_default_lvl
;
473 log_config_syslog_lvl
= level
;
474 zlog_syslog_set_prio_min(ZLOG_MAXLVL(log_config_syslog_lvl
,
475 log_cmdline_syslog_lvl
));
479 DEFUN (no_config_log_syslog
,
480 no_config_log_syslog_cmd
,
481 "no log syslog [<kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>] [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
484 "Cancel logging to syslog\n"
488 log_config_syslog_lvl
= ZLOG_DISABLED
;
489 zlog_syslog_set_prio_min(ZLOG_MAXLVL(log_config_syslog_lvl
,
490 log_cmdline_syslog_lvl
));
494 DEFPY (config_log_facility
,
495 config_log_facility_cmd
,
496 "log facility <kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>$facilityarg",
498 "Facility parameter for syslog messages\n"
501 int facility
= facility_match(facilityarg
);
503 zlog_syslog_set_facility(facility
);
507 DEFUN (no_config_log_facility
,
508 no_config_log_facility_cmd
,
509 "no log facility [<kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>]",
512 "Reset syslog facility to default (daemon)\n"
515 zlog_syslog_set_facility(LOG_DAEMON
);
519 DEFUN (config_log_record_priority
,
520 config_log_record_priority_cmd
,
521 "log record-priority",
523 "Log the priority of the message within the message\n")
525 zt_file
.record_priority
= true;
526 zlog_file_set_other(&zt_file
);
527 zt_stdout
.record_priority
= true;
528 zlog_file_set_other(&zt_stdout
);
529 zt_filterfile
.parent
.record_priority
= true;
530 zlog_file_set_other(&zt_filterfile
.parent
);
534 DEFUN (no_config_log_record_priority
,
535 no_config_log_record_priority_cmd
,
536 "no log record-priority",
539 "Do not log the priority of the message within the message\n")
541 zt_file
.record_priority
= false;
542 zlog_file_set_other(&zt_file
);
543 zt_stdout
.record_priority
= false;
544 zlog_file_set_other(&zt_stdout
);
545 zt_filterfile
.parent
.record_priority
= false;
546 zlog_file_set_other(&zt_filterfile
.parent
);
550 DEFPY (config_log_timestamp_precision
,
551 config_log_timestamp_precision_cmd
,
552 "log timestamp precision (0-6)",
554 "Timestamp configuration\n"
555 "Set the timestamp precision\n"
556 "Number of subsecond digits\n")
558 zt_file
.ts_subsec
= precision
;
559 zlog_file_set_other(&zt_file
);
560 zt_stdout
.ts_subsec
= precision
;
561 zlog_file_set_other(&zt_stdout
);
562 zt_filterfile
.parent
.ts_subsec
= precision
;
563 zlog_file_set_other(&zt_filterfile
.parent
);
567 DEFUN (no_config_log_timestamp_precision
,
568 no_config_log_timestamp_precision_cmd
,
569 "no log timestamp precision [(0-6)]",
572 "Timestamp configuration\n"
573 "Reset the timestamp precision to the default value of 0\n"
574 "Number of subsecond digits\n")
576 zt_file
.ts_subsec
= 0;
577 zlog_file_set_other(&zt_file
);
578 zt_stdout
.ts_subsec
= 0;
579 zlog_file_set_other(&zt_stdout
);
580 zt_filterfile
.parent
.ts_subsec
= 0;
581 zlog_file_set_other(&zt_filterfile
.parent
);
585 DEFPY (config_log_ec
,
587 "[no] log error-category",
590 "Prefix log message text with [EC 9999] code\n")
592 zlog_set_prefix_ec(!no
);
596 DEFPY (config_log_xid
,
598 "[no] log unique-id",
601 "Prefix log message text with [XXXXX-XXXXX] identifier\n")
603 zlog_set_prefix_xid(!no
);
607 DEFPY (config_log_filterfile
,
608 config_log_filterfile_cmd
,
609 "log filtered-file FILENAME [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>$levelarg]",
611 "Logging to file with string filter\n"
615 int level
= log_default_lvl
;
618 level
= log_level_match(levelarg
);
619 if (level
== ZLOG_DISABLED
)
620 return CMD_ERR_NO_MATCH
;
622 return set_log_file(&zt_filterfile
.parent
, vty
, filename
, level
);
625 DEFUN (no_config_log_filterfile
,
626 no_config_log_filterfile_cmd
,
627 "no log filtered-file [FILENAME [LEVEL]]",
630 "Cancel logging to file with string filter\n"
631 "Logging file name\n"
634 zt_filterfile
.parent
.prio_min
= ZLOG_DISABLED
;
635 zlog_file_set_other(&zt_filterfile
.parent
);
641 "[no] log filter-text WORD$filter",
645 "String to filter by\n")
650 ret
= zlog_filter_del(filter
);
652 ret
= zlog_filter_add(filter
);
655 vty_out(vty
, "%% filter table full\n");
657 } else if (ret
!= 0) {
658 vty_out(vty
, "%% failed to %s log filter\n",
659 (no
? "remove" : "apply"));
663 vty_out(vty
, " %s\n", filter
);
667 /* Clear all log filters */
668 DEFPY (log_filter_clear
,
669 log_filter_clear_cmd
,
670 "clear log filter-text",
679 /* Show log filter */
680 DEFPY (show_log_filter
,
682 "show logging filter-text",
684 "Show current logging configuration\n"
687 char log_filters
[ZLOG_FILTERS_MAX
* (ZLOG_FILTER_LENGTH_MAX
+ 3)] = "";
690 len
= zlog_filter_dump(log_filters
, sizeof(log_filters
));
693 vty_out(vty
, "%% failed to get filters\n");
698 vty_out(vty
, "%s", log_filters
);
703 /* Enable/disable 'immediate' mode, with no output buffering */
704 DEFPY (log_immediate_mode
,
705 log_immediate_mode_cmd
,
706 "[no] log immediate-mode",
709 "Output immediately, without buffering")
711 zlog_set_immediate(!no
);
715 void log_config_write(struct vty
*vty
)
717 bool show_cmdline_hint
= false;
719 if (zt_file
.prio_min
!= ZLOG_DISABLED
&& zt_file
.filename
) {
720 vty_out(vty
, "log file %s", zt_file
.filename
);
722 if (zt_file
.prio_min
!= log_default_lvl
)
723 vty_out(vty
, " %s", zlog_priority
[zt_file
.prio_min
]);
727 if (zt_filterfile
.parent
.prio_min
!= ZLOG_DISABLED
728 && zt_filterfile
.parent
.filename
) {
729 vty_out(vty
, "log filtered-file %s",
730 zt_filterfile
.parent
.filename
);
732 if (zt_filterfile
.parent
.prio_min
!= log_default_lvl
)
734 zlog_priority
[zt_filterfile
.parent
.prio_min
]);
738 if (log_config_stdout_lvl
!= ZLOG_DISABLED
) {
739 vty_out(vty
, "log stdout");
741 if (log_config_stdout_lvl
!= log_default_lvl
)
743 zlog_priority
[log_config_stdout_lvl
]);
747 if (log_config_syslog_lvl
!= ZLOG_DISABLED
) {
748 vty_out(vty
, "log syslog");
750 if (log_config_syslog_lvl
!= log_default_lvl
)
752 zlog_priority
[log_config_syslog_lvl
]);
756 if (log_cmdline_syslog_lvl
!= ZLOG_DISABLED
) {
758 "! \"log syslog %s\" enabled by \"--log\" startup option\n",
759 zlog_priority
[log_cmdline_syslog_lvl
]);
760 show_cmdline_hint
= true;
762 if (log_cmdline_stdout_lvl
!= ZLOG_DISABLED
) {
764 "! \"log stdout %s\" enabled by \"--log\" startup option\n",
765 zlog_priority
[log_cmdline_stdout_lvl
]);
766 show_cmdline_hint
= true;
768 if (zt_file_cmdline
.prio_min
!= ZLOG_DISABLED
) {
770 "! \"log file %s %s\" enabled by \"--log\" startup option\n",
771 zt_file_cmdline
.filename
,
772 zlog_priority
[zt_file_cmdline
.prio_min
]);
773 show_cmdline_hint
= true;
775 if (show_cmdline_hint
)
777 "! use \"clear log cmdline-targets\" to remove this target\n");
779 if (zlog_syslog_get_facility() != LOG_DAEMON
)
780 vty_out(vty
, "log facility %s\n",
781 facility_name(zlog_syslog_get_facility()));
783 if (zt_file
.record_priority
== 1)
784 vty_out(vty
, "log record-priority\n");
786 if (zt_file
.ts_subsec
> 0)
787 vty_out(vty
, "log timestamp precision %d\n",
790 if (!zlog_get_prefix_ec())
791 vty_out(vty
, "no log error-category\n");
792 if (!zlog_get_prefix_xid())
793 vty_out(vty
, "no log unique-id\n");
795 if (logmsgs_with_persist_bt
) {
796 struct xrefdata
*xrd
;
797 struct xrefdata_logmsg
*xrdl
;
801 frr_each (xrefdata_uid
, &xrefdata_uid
, xrd
) {
802 if (xrd
->xref
->type
!= XREFT_LOGMSG
)
805 xrdl
= container_of(xrd
, struct xrefdata_logmsg
,
807 if (xrdl
->fl_print_bt
& LOGMSG_FLAG_PERSISTENT
)
808 vty_out(vty
, "debug unique-id %s backtrace\n",
814 static int log_vty_init(const char *progname
, const char *protoname
,
815 unsigned short instance
, uid_t uid
, gid_t gid
)
817 zlog_progname
= progname
;
818 zlog_protoname
= protoname
;
820 zlog_set_prefix_ec(true);
821 zlog_set_prefix_xid(true);
823 zlog_filterfile_init(&zt_filterfile
);
825 zlog_file_set_fd(&zt_stdout
, STDOUT_FILENO
);
829 __attribute__((_CONSTRUCTOR(475))) static void log_vty_preinit(void)
831 hook_register(zlog_init
, log_vty_init
);
834 void log_cmd_init(void)
836 install_element(VIEW_NODE
, &show_logging_cmd
);
837 install_element(ENABLE_NODE
, &clear_log_cmdline_cmd
);
839 install_element(CONFIG_NODE
, &config_log_stdout_cmd
);
840 install_element(CONFIG_NODE
, &no_config_log_stdout_cmd
);
841 install_element(CONFIG_NODE
, &config_log_monitor_cmd
);
842 install_element(CONFIG_NODE
, &no_config_log_monitor_cmd
);
843 install_element(CONFIG_NODE
, &config_log_file_cmd
);
844 install_element(CONFIG_NODE
, &no_config_log_file_cmd
);
845 install_element(CONFIG_NODE
, &config_log_syslog_cmd
);
846 install_element(CONFIG_NODE
, &no_config_log_syslog_cmd
);
847 install_element(CONFIG_NODE
, &config_log_facility_cmd
);
848 install_element(CONFIG_NODE
, &no_config_log_facility_cmd
);
849 install_element(CONFIG_NODE
, &config_log_record_priority_cmd
);
850 install_element(CONFIG_NODE
, &no_config_log_record_priority_cmd
);
851 install_element(CONFIG_NODE
, &config_log_timestamp_precision_cmd
);
852 install_element(CONFIG_NODE
, &no_config_log_timestamp_precision_cmd
);
853 install_element(CONFIG_NODE
, &config_log_ec_cmd
);
854 install_element(CONFIG_NODE
, &config_log_xid_cmd
);
856 install_element(VIEW_NODE
, &show_log_filter_cmd
);
857 install_element(CONFIG_NODE
, &log_filter_cmd
);
858 install_element(CONFIG_NODE
, &log_filter_clear_cmd
);
859 install_element(CONFIG_NODE
, &config_log_filterfile_cmd
);
860 install_element(CONFIG_NODE
, &no_config_log_filterfile_cmd
);
861 install_element(CONFIG_NODE
, &log_immediate_mode_cmd
);
863 install_element(ENABLE_NODE
, &debug_uid_backtrace_cmd
);
864 install_element(CONFIG_NODE
, &debug_uid_backtrace_cmd
);