blob: 6166f1f231d942fbfc54fb3225ab315c2692693d [file] [log] [blame]
Harald Welte3fb0b6f2010-05-19 19:02:52 +02001/* OpenBSC logging helper for the VTY */
2/* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
3 * (C) 2009-2010 by Holger Hans Peter Freyther
4 * All Rights Reserved
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 */
21
22#include <stdlib.h>
23#include <string.h>
24
Harald Welte28222962011-02-18 20:37:04 +010025#include "../../config.h"
26
Pablo Neira Ayuso83419342011-03-22 16:36:13 +010027#include <osmocom/core/talloc.h>
28#include <osmocom/core/logging.h>
29#include <osmocom/core/utils.h>
Harald Welte3fb0b6f2010-05-19 19:02:52 +020030
31//#include <openbsc/vty.h>
32
33#include <osmocom/vty/command.h>
34#include <osmocom/vty/buffer.h>
35#include <osmocom/vty/vty.h>
36#include <osmocom/vty/telnet_interface.h>
37#include <osmocom/vty/logging.h>
38
Harald Welte28222962011-02-18 20:37:04 +010039#define LOG_STR "Configure logging sub-system\n"
40
Harald Welte4ebdf742010-05-19 19:54:00 +020041extern const struct log_info *osmo_log_info;
Harald Welte3fb0b6f2010-05-19 19:02:52 +020042
Harald Welte76e72ab2011-02-17 15:52:39 +010043static void _vty_output(struct log_target *tgt,
44 unsigned int level, const char *line)
Harald Welte3fb0b6f2010-05-19 19:02:52 +020045{
46 struct vty *vty = tgt->tgt_vty.vty;
47 vty_out(vty, "%s", line);
48 /* This is an ugly hack, but there is no easy way... */
49 if (strchr(line, '\n'))
50 vty_out(vty, "\r");
51}
52
53struct log_target *log_target_create_vty(struct vty *vty)
54{
55 struct log_target *target;
56
57 target = log_target_create();
58 if (!target)
59 return NULL;
60
61 target->tgt_vty.vty = vty;
62 target->output = _vty_output;
63 return target;
64}
65
66DEFUN(enable_logging,
67 enable_logging_cmd,
68 "logging enable",
69 LOGGING_STR
70 "Enables logging to this vty\n")
71{
72 struct telnet_connection *conn;
73
74 conn = (struct telnet_connection *) vty->priv;
75 if (conn->dbg) {
76 vty_out(vty, "Logging already enabled.%s", VTY_NEWLINE);
77 return CMD_WARNING;
78 }
79
80 conn->dbg = log_target_create_vty(vty);
81 if (!conn->dbg)
82 return CMD_WARNING;
83
84 log_add_target(conn->dbg);
85 return CMD_SUCCESS;
86}
87
Harald Weltea62648b2011-02-18 21:03:27 +010088struct log_target *osmo_log_vty2tgt(struct vty *vty)
89{
90 struct telnet_connection *conn;
91
92 if (vty->node == CFG_LOG_NODE)
93 return vty->index;
94
95
96 conn = (struct telnet_connection *) vty->priv;
97 if (!conn->dbg)
98 vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE);
99
100 return conn->dbg;
101}
102
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200103DEFUN(logging_fltr_all,
104 logging_fltr_all_cmd,
105 "logging filter all (0|1)",
106 LOGGING_STR FILTER_STR
107 "Do you want to log all messages?\n"
108 "Only print messages matched by other filters\n"
109 "Bypass filter and print all messages\n")
110{
Harald Weltea62648b2011-02-18 21:03:27 +0100111 struct log_target *tgt = osmo_log_vty2tgt(vty);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200112
Harald Weltea62648b2011-02-18 21:03:27 +0100113 if (!tgt)
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200114 return CMD_WARNING;
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200115
Harald Weltea62648b2011-02-18 21:03:27 +0100116 log_set_all_filter(tgt, atoi(argv[0]));
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200117 return CMD_SUCCESS;
118}
119
120DEFUN(logging_use_clr,
121 logging_use_clr_cmd,
122 "logging color (0|1)",
123 LOGGING_STR "Configure color-printing for log messages\n"
124 "Don't use color for printing messages\n"
125 "Use color for printing messages\n")
126{
Harald Weltea62648b2011-02-18 21:03:27 +0100127 struct log_target *tgt = osmo_log_vty2tgt(vty);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200128
Harald Weltea62648b2011-02-18 21:03:27 +0100129 if (!tgt)
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200130 return CMD_WARNING;
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200131
Harald Weltea62648b2011-02-18 21:03:27 +0100132 log_set_use_color(tgt, atoi(argv[0]));
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200133 return CMD_SUCCESS;
134}
135
136DEFUN(logging_prnt_timestamp,
137 logging_prnt_timestamp_cmd,
138 "logging timestamp (0|1)",
139 LOGGING_STR "Configure log message timestamping\n"
140 "Don't prefix each log message\n"
141 "Prefix each log message with current timestamp\n")
142{
Harald Weltea62648b2011-02-18 21:03:27 +0100143 struct log_target *tgt = osmo_log_vty2tgt(vty);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200144
Harald Weltea62648b2011-02-18 21:03:27 +0100145 if (!tgt)
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200146 return CMD_WARNING;
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200147
Harald Weltea62648b2011-02-18 21:03:27 +0100148 log_set_print_timestamp(tgt, atoi(argv[0]));
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200149 return CMD_SUCCESS;
150}
151
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200152DEFUN(logging_level,
153 logging_level_cmd,
Pablo Neira Ayuso04139f12011-03-09 13:05:08 +0100154 NULL, /* cmdstr is dynamically set in logging_vty_add_cmds(). */
155 NULL) /* same thing for helpstr. */
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200156{
Harald Weltea62648b2011-02-18 21:03:27 +0100157 int category = log_parse_category(argv[0]);
158 int level = log_parse_level(argv[1]);
159 struct log_target *tgt = osmo_log_vty2tgt(vty);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200160
Harald Weltea62648b2011-02-18 21:03:27 +0100161 if (!tgt)
162 return CMD_WARNING;
163
164 if (level < 0) {
165 vty_out(vty, "Invalid level `%s'%s", argv[1], VTY_NEWLINE);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200166 return CMD_WARNING;
167 }
168
Harald Weltea62648b2011-02-18 21:03:27 +0100169 /* Check for special case where we want to set global log level */
170 if (!strcmp(argv[0], "all")) {
171 log_set_log_level(tgt, level);
172 return CMD_SUCCESS;
173 }
174
175 if (category < 0) {
176 vty_out(vty, "Invalid category `%s'%s", argv[0], VTY_NEWLINE);
177 return CMD_WARNING;
178 }
179
180 tgt->categories[category].enabled = 1;
181 tgt->categories[category].loglevel = level;
182
183 return CMD_SUCCESS;
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200184}
185
186DEFUN(logging_set_category_mask,
187 logging_set_category_mask_cmd,
Holger Hans Peter Freyther146d1d32011-10-03 23:15:41 +0200188 "logging set-log-mask MASK",
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200189 LOGGING_STR
Holger Hans Peter Freyther146d1d32011-10-03 23:15:41 +0200190 "Set the logmask of this logging target\n"
191 "The logmask to use\n")
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200192{
Harald Weltea62648b2011-02-18 21:03:27 +0100193 struct log_target *tgt = osmo_log_vty2tgt(vty);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200194
Harald Weltea62648b2011-02-18 21:03:27 +0100195 if (!tgt)
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200196 return CMD_WARNING;
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200197
Harald Weltea62648b2011-02-18 21:03:27 +0100198 log_parse_category_mask(tgt, argv[0]);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200199 return CMD_SUCCESS;
200}
201
Holger Hans Peter Freyther146d1d32011-10-03 23:15:41 +0200202ALIAS_DEPRECATED(logging_set_category_mask,
203 logging_set_category_mask_old_cmd,
204 "logging set log mask MASK",
205 LOGGING_STR
206 "Decide which categories to output.\n"
207 "Log commands\n" "Mask commands\n" "The logmask to use\n");
208
209
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200210DEFUN(diable_logging,
211 disable_logging_cmd,
212 "logging disable",
213 LOGGING_STR
214 "Disables logging to this vty\n")
215{
Harald Weltea62648b2011-02-18 21:03:27 +0100216 struct log_target *tgt = osmo_log_vty2tgt(vty);
217 struct telnet_connection *conn = (struct telnet_connection *) vty->priv;
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200218
Harald Weltea62648b2011-02-18 21:03:27 +0100219 if (!tgt)
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200220 return CMD_WARNING;
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200221
Harald Weltea62648b2011-02-18 21:03:27 +0100222 log_del_target(tgt);
223 talloc_free(tgt);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200224 conn->dbg = NULL;
Harald Weltea62648b2011-02-18 21:03:27 +0100225
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200226 return CMD_SUCCESS;
227}
228
229static void vty_print_logtarget(struct vty *vty, const struct log_info *info,
230 const struct log_target *tgt)
231{
232 unsigned int i;
233
234 vty_out(vty, " Global Loglevel: %s%s",
235 log_level_str(tgt->loglevel), VTY_NEWLINE);
236 vty_out(vty, " Use color: %s, Print Timestamp: %s%s",
237 tgt->use_color ? "On" : "Off",
238 tgt->print_timestamp ? "On" : "Off", VTY_NEWLINE);
239
240 vty_out(vty, " Log Level specific information:%s", VTY_NEWLINE);
241
242 for (i = 0; i < info->num_cat; i++) {
243 const struct log_category *cat = &tgt->categories[i];
244 vty_out(vty, " %-10s %-10s %-8s %s%s",
245 info->cat[i].name+1, log_level_str(cat->loglevel),
246 cat->enabled ? "Enabled" : "Disabled",
247 info->cat[i].description,
248 VTY_NEWLINE);
249 }
250}
251
252#define SHOW_LOG_STR "Show current logging configuration\n"
253
254DEFUN(show_logging_vty,
255 show_logging_vty_cmd,
256 "show logging vty",
257 SHOW_STR SHOW_LOG_STR
258 "Show current logging configuration for this vty\n")
259{
Harald Weltea62648b2011-02-18 21:03:27 +0100260 struct log_target *tgt = osmo_log_vty2tgt(vty);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200261
Harald Weltea62648b2011-02-18 21:03:27 +0100262 if (!tgt)
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200263 return CMD_WARNING;
Harald Weltea62648b2011-02-18 21:03:27 +0100264
265 vty_print_logtarget(vty, osmo_log_info, tgt);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200266
267 return CMD_SUCCESS;
268}
269
270gDEFUN(cfg_description, cfg_description_cmd,
271 "description .TEXT",
Holger Hans Peter Freytherc9b3e062012-07-25 13:02:49 +0200272 "Save human-readable decription of the object\n"
273 "Text until the end of the line\n")
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200274{
275 char **dptr = vty->index_sub;
276
277 if (!dptr) {
278 vty_out(vty, "vty->index_sub == NULL%s", VTY_NEWLINE);
279 return CMD_WARNING;
280 }
281
Holger Hans Peter Freytherff0670e2011-02-24 14:20:41 +0100282 if (*dptr)
283 talloc_free(*dptr);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200284 *dptr = argv_concat(argv, argc, 0);
285 if (!dptr)
286 return CMD_WARNING;
287
288 return CMD_SUCCESS;
289}
290
291gDEFUN(cfg_no_description, cfg_no_description_cmd,
292 "no description",
293 NO_STR
294 "Remove description of the object\n")
295{
296 char **dptr = vty->index_sub;
297
298 if (!dptr) {
299 vty_out(vty, "vty->index_sub == NULL%s", VTY_NEWLINE);
300 return CMD_WARNING;
301 }
302
303 if (*dptr) {
304 talloc_free(*dptr);
305 *dptr = NULL;
306 }
307
308 return CMD_SUCCESS;
309}
310
Harald Welte28222962011-02-18 20:37:04 +0100311/* Support for configuration of log targets != the current vty */
312
313struct cmd_node cfg_log_node = {
314 CFG_LOG_NODE,
315 "%s(config-log)# ",
316 1
317};
318
Harald Welte28222962011-02-18 20:37:04 +0100319#ifdef HAVE_SYSLOG_H
320
321#include <syslog.h>
322
323static const int local_sysl_map[] = {
324 [0] = LOG_LOCAL0,
325 [1] = LOG_LOCAL1,
326 [2] = LOG_LOCAL2,
327 [3] = LOG_LOCAL3,
328 [4] = LOG_LOCAL4,
329 [5] = LOG_LOCAL5,
330 [6] = LOG_LOCAL6,
331 [7] = LOG_LOCAL7
332};
333
Harald Weltede79cee2011-02-24 23:47:57 +0100334/* From VTY core code */
335extern struct host host;
336
Harald Welte28222962011-02-18 20:37:04 +0100337static int _cfg_log_syslog(struct vty *vty, int facility)
338{
339 struct log_target *tgt;
340
341 /* First delete the old syslog target, if any */
342 tgt = log_target_find(LOG_TGT_TYPE_SYSLOG, NULL);
343 if (tgt)
344 log_target_destroy(tgt);
345
Harald Weltede79cee2011-02-24 23:47:57 +0100346 tgt = log_target_create_syslog(host.app_info->name, 0, facility);
Harald Welte28222962011-02-18 20:37:04 +0100347 if (!tgt) {
348 vty_out(vty, "%% Unable to open syslog%s", VTY_NEWLINE);
349 return CMD_WARNING;
350 }
351 log_add_target(tgt);
352
353 vty->index = tgt;
354 vty->node = CFG_LOG_NODE;
355
356 return CMD_SUCCESS;
357}
358
359DEFUN(cfg_log_syslog_local, cfg_log_syslog_local_cmd,
360 "log syslog local <0-7>",
361 LOG_STR "Logging via syslog\n" "Syslog LOCAL facility\n"
362 "Local facility number\n")
363{
364 int local = atoi(argv[0]);
365 int facility = local_sysl_map[local];
366
367 return _cfg_log_syslog(vty, facility);
368}
369
370static struct value_string sysl_level_names[] = {
371 { LOG_AUTHPRIV, "authpriv" },
372 { LOG_CRON, "cron" },
373 { LOG_DAEMON, "daemon" },
374 { LOG_FTP, "ftp" },
375 { LOG_LPR, "lpr" },
376 { LOG_MAIL, "mail" },
377 { LOG_NEWS, "news" },
378 { LOG_USER, "user" },
379 { LOG_UUCP, "uucp" },
380 /* only for value -> string conversion */
381 { LOG_LOCAL0, "local 0" },
382 { LOG_LOCAL1, "local 1" },
383 { LOG_LOCAL2, "local 2" },
384 { LOG_LOCAL3, "local 3" },
385 { LOG_LOCAL4, "local 4" },
386 { LOG_LOCAL5, "local 5" },
387 { LOG_LOCAL6, "local 6" },
388 { LOG_LOCAL7, "local 7" },
389 { 0, NULL }
390};
391
392DEFUN(cfg_log_syslog, cfg_log_syslog_cmd,
393 "log syslog (authpriv|cron|daemon|ftp|lpr|mail|news|user|uucp)",
Holger Hans Peter Freythera4463fd2011-10-03 23:17:36 +0200394 LOG_STR "Logging via syslog\n"
395 "Security/authorization messages facility\n"
396 "Clock daemon (cron/at) facility\n"
397 "General system daemon facility\n"
398 "Ftp daemon facility\n"
399 "Line printer facility\n"
400 "Mail facility\n"
401 "News facility\n"
402 "Generic facility\n"
403 "UUCP facility\n")
Harald Welte28222962011-02-18 20:37:04 +0100404{
405 int facility = get_string_value(sysl_level_names, argv[0]);
406
407 return _cfg_log_syslog(vty, facility);
408}
409
410DEFUN(cfg_no_log_syslog, cfg_no_log_syslog_cmd,
411 "no log syslog",
412 NO_STR LOG_STR "Logging via syslog\n")
413{
414 struct log_target *tgt;
415
416 tgt = log_target_find(LOG_TGT_TYPE_SYSLOG, NULL);
417 if (!tgt) {
418 vty_out(vty, "%% No syslog target found%s",
419 VTY_NEWLINE);
420 return CMD_WARNING;
421 }
422
423 log_target_destroy(tgt);
424
425 return CMD_SUCCESS;
426}
427#endif /* HAVE_SYSLOG_H */
428
429DEFUN(cfg_log_stderr, cfg_log_stderr_cmd,
430 "log stderr",
431 LOG_STR "Logging via STDERR of the process\n")
432{
433 struct log_target *tgt;
434
435 tgt = log_target_find(LOG_TGT_TYPE_STDERR, NULL);
436 if (!tgt) {
437 tgt = log_target_create_stderr();
438 if (!tgt) {
439 vty_out(vty, "%% Unable to create stderr log%s",
440 VTY_NEWLINE);
441 return CMD_WARNING;
442 }
443 log_add_target(tgt);
444 }
445
446 vty->index = tgt;
447 vty->node = CFG_LOG_NODE;
448
449 return CMD_SUCCESS;
450}
451
452DEFUN(cfg_no_log_stderr, cfg_no_log_stderr_cmd,
453 "no log stderr",
454 NO_STR LOG_STR "Logging via STDERR of the process\n")
455{
456 struct log_target *tgt;
457
458 tgt = log_target_find(LOG_TGT_TYPE_STDERR, NULL);
459 if (!tgt) {
460 vty_out(vty, "%% No stderr logging active%s", VTY_NEWLINE);
461 return CMD_WARNING;
462 }
463
464 log_target_destroy(tgt);
465
466 return CMD_SUCCESS;
467}
468
469DEFUN(cfg_log_file, cfg_log_file_cmd,
470 "log file .FILENAME",
471 LOG_STR "Logging to text file\n" "Filename\n")
472{
473 const char *fname = argv[0];
474 struct log_target *tgt;
475
476 tgt = log_target_find(LOG_TGT_TYPE_FILE, fname);
477 if (!tgt) {
478 tgt = log_target_create_file(fname);
479 if (!tgt) {
480 vty_out(vty, "%% Unable to create file `%s'%s",
481 fname, VTY_NEWLINE);
482 return CMD_WARNING;
483 }
484 log_add_target(tgt);
485 }
486
487 vty->index = tgt;
488 vty->node = CFG_LOG_NODE;
489
490 return CMD_SUCCESS;
491}
492
493
494DEFUN(cfg_no_log_file, cfg_no_log_file_cmd,
495 "no log file .FILENAME",
496 NO_STR LOG_STR "Logging to text file\n" "Filename\n")
497{
498 const char *fname = argv[0];
499 struct log_target *tgt;
500
501 tgt = log_target_find(LOG_TGT_TYPE_FILE, fname);
502 if (!tgt) {
503 vty_out(vty, "%% No such log file `%s'%s",
504 fname, VTY_NEWLINE);
505 return CMD_WARNING;
506 }
507
508 log_target_destroy(tgt);
509
510 return CMD_SUCCESS;
511}
512
513static int config_write_log_single(struct vty *vty, struct log_target *tgt)
514{
515 int i;
516 char level_lower[32];
517
518 switch (tgt->type) {
519 case LOG_TGT_TYPE_VTY:
520 return 1;
521 break;
522 case LOG_TGT_TYPE_STDERR:
523 vty_out(vty, "log stderr%s", VTY_NEWLINE);
524 break;
525 case LOG_TGT_TYPE_SYSLOG:
526#ifdef HAVE_SYSLOG_H
527 vty_out(vty, "log syslog %s%s",
528 get_value_string(sysl_level_names,
529 tgt->tgt_syslog.facility),
530 VTY_NEWLINE);
531#endif
532 break;
533 case LOG_TGT_TYPE_FILE:
534 vty_out(vty, "log file %s%s", tgt->tgt_file.fname, VTY_NEWLINE);
535 break;
536 }
537
538 vty_out(vty, " logging color %u%s", tgt->use_color ? 1 : 0,
539 VTY_NEWLINE);
540 vty_out(vty, " logging timestamp %u%s", tgt->print_timestamp ? 1 : 0,
541 VTY_NEWLINE);
542
543 /* stupid old osmo logging API uses uppercase strings... */
544 osmo_str2lower(level_lower, log_level_str(tgt->loglevel));
545 vty_out(vty, " logging level all %s%s", level_lower, VTY_NEWLINE);
546
547 for (i = 0; i < osmo_log_info->num_cat; i++) {
548 const struct log_category *cat = &tgt->categories[i];
549 char cat_lower[32];
550
551 /* stupid old osmo logging API uses uppercase strings... */
552 osmo_str2lower(cat_lower, osmo_log_info->cat[i].name+1);
553 osmo_str2lower(level_lower, log_level_str(cat->loglevel));
554
555 vty_out(vty, " logging level %s %s%s", cat_lower, level_lower,
556 VTY_NEWLINE);
557 }
558
559 /* FIXME: levels */
560
561 return 1;
562}
563
564static int config_write_log(struct vty *vty)
565{
566 struct log_target *dbg = vty->index;
567
568 llist_for_each_entry(dbg, &osmo_log_target_list, entry)
569 config_write_log_single(vty, dbg);
570
571 return 1;
572}
573
Pablo Neira Ayuso04139f12011-03-09 13:05:08 +0100574void logging_vty_add_cmds(const struct log_info *cat)
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200575{
576 install_element_ve(&enable_logging_cmd);
577 install_element_ve(&disable_logging_cmd);
578 install_element_ve(&logging_fltr_all_cmd);
579 install_element_ve(&logging_use_clr_cmd);
580 install_element_ve(&logging_prnt_timestamp_cmd);
581 install_element_ve(&logging_set_category_mask_cmd);
Holger Hans Peter Freyther146d1d32011-10-03 23:15:41 +0200582 install_element_ve(&logging_set_category_mask_old_cmd);
Pablo Neira Ayuso04139f12011-03-09 13:05:08 +0100583
584 /* Logging level strings are generated dynamically. */
585 logging_level_cmd.string = log_vty_command_string(cat);
586 logging_level_cmd.doc = log_vty_command_description(cat);
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200587 install_element_ve(&logging_level_cmd);
588 install_element_ve(&show_logging_vty_cmd);
Harald Welte28222962011-02-18 20:37:04 +0100589
590 install_node(&cfg_log_node, config_write_log);
Harald Weltea62648b2011-02-18 21:03:27 +0100591 install_element(CFG_LOG_NODE, &logging_fltr_all_cmd);
592 install_element(CFG_LOG_NODE, &logging_use_clr_cmd);
593 install_element(CFG_LOG_NODE, &logging_prnt_timestamp_cmd);
594 install_element(CFG_LOG_NODE, &logging_level_cmd);
Harald Welte28222962011-02-18 20:37:04 +0100595
596 install_element(CONFIG_NODE, &cfg_log_stderr_cmd);
597 install_element(CONFIG_NODE, &cfg_no_log_stderr_cmd);
598 install_element(CONFIG_NODE, &cfg_log_file_cmd);
599 install_element(CONFIG_NODE, &cfg_no_log_file_cmd);
600#ifdef HAVE_SYSLOG_H
601 install_element(CONFIG_NODE, &cfg_log_syslog_cmd);
602 install_element(CONFIG_NODE, &cfg_log_syslog_local_cmd);
603 install_element(CONFIG_NODE, &cfg_no_log_syslog_cmd);
604#endif
Harald Welte3fb0b6f2010-05-19 19:02:52 +0200605}