Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 1 | /*! \file logging_vty.c |
| 2 | * OpenBSC logging helper for the VTY. */ |
| 3 | /* |
| 4 | * (C) 2009-2010 by Harald Welte <laforge@gnumonks.org> |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 5 | * (C) 2009-2014 by Holger Hans Peter Freyther |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 21 | * |
| 22 | */ |
| 23 | |
| 24 | #include <stdlib.h> |
| 25 | #include <string.h> |
| 26 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 27 | #include "../../config.h" |
| 28 | |
Pablo Neira Ayuso | 8341934 | 2011-03-22 16:36:13 +0100 | [diff] [blame] | 29 | #include <osmocom/core/talloc.h> |
| 30 | #include <osmocom/core/logging.h> |
| 31 | #include <osmocom/core/utils.h> |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 32 | #include <osmocom/core/strrb.h> |
| 33 | #include <osmocom/core/loggingrb.h> |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 34 | #include <osmocom/core/gsmtap.h> |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 35 | |
| 36 | #include <osmocom/vty/command.h> |
| 37 | #include <osmocom/vty/buffer.h> |
| 38 | #include <osmocom/vty/vty.h> |
| 39 | #include <osmocom/vty/telnet_interface.h> |
| 40 | #include <osmocom/vty/logging.h> |
| 41 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 42 | #define LOG_STR "Configure logging sub-system\n" |
| 43 | |
Harald Welte | 96e2a00 | 2017-06-12 21:44:18 +0200 | [diff] [blame] | 44 | /*! \addtogroup logging |
| 45 | * @{ |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 46 | * Configuration of logging from VTY |
Harald Welte | 96e2a00 | 2017-06-12 21:44:18 +0200 | [diff] [blame] | 47 | * |
| 48 | * This module implements functions that permit configuration of |
| 49 | * the libosmocore logging framework from VTY commands. This applies |
| 50 | * both to logging to the VTY (telnet sessions), as well as logging to |
| 51 | * other targets, such as sysslog, file, gsmtap, ... |
| 52 | */ |
| 53 | |
Harald Welte | 4ebdf74 | 2010-05-19 19:54:00 +0200 | [diff] [blame] | 54 | extern const struct log_info *osmo_log_info; |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 55 | |
Harald Welte | 76e72ab | 2011-02-17 15:52:39 +0100 | [diff] [blame] | 56 | static void _vty_output(struct log_target *tgt, |
| 57 | unsigned int level, const char *line) |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 58 | { |
| 59 | struct vty *vty = tgt->tgt_vty.vty; |
| 60 | vty_out(vty, "%s", line); |
| 61 | /* This is an ugly hack, but there is no easy way... */ |
| 62 | if (strchr(line, '\n')) |
| 63 | vty_out(vty, "\r"); |
| 64 | } |
| 65 | |
| 66 | struct log_target *log_target_create_vty(struct vty *vty) |
| 67 | { |
| 68 | struct log_target *target; |
| 69 | |
| 70 | target = log_target_create(); |
| 71 | if (!target) |
| 72 | return NULL; |
| 73 | |
| 74 | target->tgt_vty.vty = vty; |
| 75 | target->output = _vty_output; |
| 76 | return target; |
| 77 | } |
| 78 | |
| 79 | DEFUN(enable_logging, |
| 80 | enable_logging_cmd, |
| 81 | "logging enable", |
| 82 | LOGGING_STR |
| 83 | "Enables logging to this vty\n") |
| 84 | { |
| 85 | struct telnet_connection *conn; |
| 86 | |
| 87 | conn = (struct telnet_connection *) vty->priv; |
| 88 | if (conn->dbg) { |
| 89 | vty_out(vty, "Logging already enabled.%s", VTY_NEWLINE); |
| 90 | return CMD_WARNING; |
| 91 | } |
| 92 | |
| 93 | conn->dbg = log_target_create_vty(vty); |
| 94 | if (!conn->dbg) |
| 95 | return CMD_WARNING; |
| 96 | |
| 97 | log_add_target(conn->dbg); |
| 98 | return CMD_SUCCESS; |
| 99 | } |
| 100 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 101 | struct log_target *osmo_log_vty2tgt(struct vty *vty) |
| 102 | { |
| 103 | struct telnet_connection *conn; |
| 104 | |
| 105 | if (vty->node == CFG_LOG_NODE) |
| 106 | return vty->index; |
| 107 | |
| 108 | |
| 109 | conn = (struct telnet_connection *) vty->priv; |
| 110 | if (!conn->dbg) |
| 111 | vty_out(vty, "Logging was not enabled.%s", VTY_NEWLINE); |
| 112 | |
| 113 | return conn->dbg; |
| 114 | } |
| 115 | |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 116 | DEFUN(logging_fltr_all, |
| 117 | logging_fltr_all_cmd, |
| 118 | "logging filter all (0|1)", |
| 119 | LOGGING_STR FILTER_STR |
| 120 | "Do you want to log all messages?\n" |
| 121 | "Only print messages matched by other filters\n" |
| 122 | "Bypass filter and print all messages\n") |
| 123 | { |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 124 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 125 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 126 | if (!tgt) |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 127 | return CMD_WARNING; |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 128 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 129 | log_set_all_filter(tgt, atoi(argv[0])); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 130 | return CMD_SUCCESS; |
| 131 | } |
| 132 | |
| 133 | DEFUN(logging_use_clr, |
| 134 | logging_use_clr_cmd, |
| 135 | "logging color (0|1)", |
| 136 | LOGGING_STR "Configure color-printing for log messages\n" |
| 137 | "Don't use color for printing messages\n" |
| 138 | "Use color for printing messages\n") |
| 139 | { |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 140 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 141 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 142 | if (!tgt) |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 143 | return CMD_WARNING; |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 144 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 145 | log_set_use_color(tgt, atoi(argv[0])); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 146 | return CMD_SUCCESS; |
| 147 | } |
| 148 | |
| 149 | DEFUN(logging_prnt_timestamp, |
| 150 | logging_prnt_timestamp_cmd, |
| 151 | "logging timestamp (0|1)", |
| 152 | LOGGING_STR "Configure log message timestamping\n" |
| 153 | "Don't prefix each log message\n" |
| 154 | "Prefix each log message with current timestamp\n") |
| 155 | { |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 156 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 157 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 158 | if (!tgt) |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 159 | return CMD_WARNING; |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 160 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 161 | log_set_print_timestamp(tgt, atoi(argv[0])); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 162 | return CMD_SUCCESS; |
| 163 | } |
| 164 | |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 165 | DEFUN(logging_prnt_ext_timestamp, |
| 166 | logging_prnt_ext_timestamp_cmd, |
| 167 | "logging print extended-timestamp (0|1)", |
| 168 | LOGGING_STR "Log output settings\n" |
| 169 | "Configure log message timestamping\n" |
| 170 | "Don't prefix each log message\n" |
| 171 | "Prefix each log message with current timestamp with YYYYMMDDhhmmssnnn\n") |
| 172 | { |
| 173 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
| 174 | |
| 175 | if (!tgt) |
| 176 | return CMD_WARNING; |
| 177 | |
| 178 | log_set_print_extended_timestamp(tgt, atoi(argv[0])); |
| 179 | return CMD_SUCCESS; |
| 180 | } |
| 181 | |
| 182 | DEFUN(logging_prnt_cat, |
| 183 | logging_prnt_cat_cmd, |
| 184 | "logging print category (0|1)", |
| 185 | LOGGING_STR "Log output settings\n" |
| 186 | "Configure log message\n" |
| 187 | "Don't prefix each log message\n" |
| 188 | "Prefix each log message with category/subsystem name\n") |
| 189 | { |
| 190 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
| 191 | |
| 192 | if (!tgt) |
| 193 | return CMD_WARNING; |
| 194 | |
| 195 | log_set_print_category(tgt, atoi(argv[0])); |
| 196 | return CMD_SUCCESS; |
| 197 | } |
| 198 | |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 199 | DEFUN(logging_level, |
| 200 | logging_level_cmd, |
Pablo Neira Ayuso | 04139f1 | 2011-03-09 13:05:08 +0100 | [diff] [blame] | 201 | NULL, /* cmdstr is dynamically set in logging_vty_add_cmds(). */ |
| 202 | NULL) /* same thing for helpstr. */ |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 203 | { |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 204 | int category = log_parse_category(argv[0]); |
| 205 | int level = log_parse_level(argv[1]); |
| 206 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 207 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 208 | if (!tgt) |
| 209 | return CMD_WARNING; |
| 210 | |
| 211 | if (level < 0) { |
| 212 | vty_out(vty, "Invalid level `%s'%s", argv[1], VTY_NEWLINE); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 213 | return CMD_WARNING; |
| 214 | } |
| 215 | |
Max | ed0eda2 | 2017-07-06 17:09:01 +0200 | [diff] [blame] | 216 | if (strcmp(argv[1], "everything") == 0) { /* FIXME: remove this check once 'everything' is phased out */ |
| 217 | vty_out(vty, "%% Ignoring deprecated logging level %s%s", argv[1], VTY_NEWLINE); |
| 218 | return CMD_SUCCESS; |
| 219 | } |
| 220 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 221 | /* Check for special case where we want to set global log level */ |
| 222 | if (!strcmp(argv[0], "all")) { |
| 223 | log_set_log_level(tgt, level); |
| 224 | return CMD_SUCCESS; |
| 225 | } |
| 226 | |
| 227 | if (category < 0) { |
| 228 | vty_out(vty, "Invalid category `%s'%s", argv[0], VTY_NEWLINE); |
| 229 | return CMD_WARNING; |
| 230 | } |
| 231 | |
| 232 | tgt->categories[category].enabled = 1; |
| 233 | tgt->categories[category].loglevel = level; |
| 234 | |
| 235 | return CMD_SUCCESS; |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 236 | } |
| 237 | |
| 238 | DEFUN(logging_set_category_mask, |
| 239 | logging_set_category_mask_cmd, |
Holger Hans Peter Freyther | 146d1d3 | 2011-10-03 23:15:41 +0200 | [diff] [blame] | 240 | "logging set-log-mask MASK", |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 241 | LOGGING_STR |
Holger Hans Peter Freyther | 146d1d3 | 2011-10-03 23:15:41 +0200 | [diff] [blame] | 242 | "Set the logmask of this logging target\n" |
| 243 | "The logmask to use\n") |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 244 | { |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 245 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 246 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 247 | if (!tgt) |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 248 | return CMD_WARNING; |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 249 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 250 | log_parse_category_mask(tgt, argv[0]); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 251 | return CMD_SUCCESS; |
| 252 | } |
| 253 | |
Holger Hans Peter Freyther | 146d1d3 | 2011-10-03 23:15:41 +0200 | [diff] [blame] | 254 | ALIAS_DEPRECATED(logging_set_category_mask, |
| 255 | logging_set_category_mask_old_cmd, |
| 256 | "logging set log mask MASK", |
| 257 | LOGGING_STR |
| 258 | "Decide which categories to output.\n" |
| 259 | "Log commands\n" "Mask commands\n" "The logmask to use\n"); |
| 260 | |
| 261 | |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 262 | DEFUN(diable_logging, |
| 263 | disable_logging_cmd, |
| 264 | "logging disable", |
| 265 | LOGGING_STR |
| 266 | "Disables logging to this vty\n") |
| 267 | { |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 268 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
| 269 | struct telnet_connection *conn = (struct telnet_connection *) vty->priv; |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 270 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 271 | if (!tgt) |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 272 | return CMD_WARNING; |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 273 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 274 | log_del_target(tgt); |
| 275 | talloc_free(tgt); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 276 | conn->dbg = NULL; |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 277 | |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 278 | return CMD_SUCCESS; |
| 279 | } |
| 280 | |
| 281 | static void vty_print_logtarget(struct vty *vty, const struct log_info *info, |
| 282 | const struct log_target *tgt) |
| 283 | { |
| 284 | unsigned int i; |
| 285 | |
| 286 | vty_out(vty, " Global Loglevel: %s%s", |
| 287 | log_level_str(tgt->loglevel), VTY_NEWLINE); |
| 288 | vty_out(vty, " Use color: %s, Print Timestamp: %s%s", |
| 289 | tgt->use_color ? "On" : "Off", |
| 290 | tgt->print_timestamp ? "On" : "Off", VTY_NEWLINE); |
| 291 | |
| 292 | vty_out(vty, " Log Level specific information:%s", VTY_NEWLINE); |
| 293 | |
| 294 | for (i = 0; i < info->num_cat; i++) { |
| 295 | const struct log_category *cat = &tgt->categories[i]; |
Daniel Willmann | 55363a9 | 2016-11-15 10:05:51 +0100 | [diff] [blame] | 296 | /* Skip categories that were not initialized */ |
| 297 | if (!info->cat[i].name) |
| 298 | continue; |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 299 | vty_out(vty, " %-10s %-10s %-8s %s%s", |
| 300 | info->cat[i].name+1, log_level_str(cat->loglevel), |
| 301 | cat->enabled ? "Enabled" : "Disabled", |
| 302 | info->cat[i].description, |
| 303 | VTY_NEWLINE); |
| 304 | } |
Harald Welte | 6d2d4d6 | 2013-03-10 09:53:24 +0000 | [diff] [blame] | 305 | |
| 306 | vty_out(vty, " Log Filter 'ALL': %s%s", |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 307 | tgt->filter_map & (1 << LOG_FLT_ALL) ? "Enabled" : "Disabled", |
Harald Welte | 6d2d4d6 | 2013-03-10 09:53:24 +0000 | [diff] [blame] | 308 | VTY_NEWLINE); |
| 309 | |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 310 | /* print application specific filters */ |
| 311 | if (info->print_fn) |
| 312 | info->print_fn(vty, info, tgt); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | #define SHOW_LOG_STR "Show current logging configuration\n" |
| 316 | |
| 317 | DEFUN(show_logging_vty, |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 318 | show_logging_vty_cmd, |
| 319 | "show logging vty", |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 320 | SHOW_STR SHOW_LOG_STR |
| 321 | "Show current logging configuration for this vty\n") |
| 322 | { |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 323 | struct log_target *tgt = osmo_log_vty2tgt(vty); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 324 | |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 325 | if (!tgt) |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 326 | return CMD_WARNING; |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 327 | |
| 328 | vty_print_logtarget(vty, osmo_log_info, tgt); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 329 | |
| 330 | return CMD_SUCCESS; |
| 331 | } |
| 332 | |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 333 | DEFUN(show_alarms, |
| 334 | show_alarms_cmd, |
| 335 | "show alarms", |
| 336 | SHOW_STR SHOW_LOG_STR |
| 337 | "Show the contents of the logging ringbuffer\n") |
| 338 | { |
| 339 | int i, num_alarms; |
| 340 | struct osmo_strrb *rb; |
| 341 | struct log_target *tgt = log_target_find(LOG_TGT_TYPE_STRRB, NULL); |
| 342 | if (!tgt) { |
| 343 | vty_out(vty, "%% No alarms, run 'log alarms <2-32700>'%s", |
| 344 | VTY_NEWLINE); |
| 345 | return CMD_WARNING; |
| 346 | } |
| 347 | |
| 348 | rb = tgt->tgt_rb.rb; |
| 349 | num_alarms = osmo_strrb_elements(rb); |
| 350 | |
| 351 | vty_out(vty, "%% Showing %i alarms%s", num_alarms, VTY_NEWLINE); |
| 352 | |
| 353 | for (i = 0; i < num_alarms; i++) |
| 354 | vty_out(vty, "%% %s%s", osmo_strrb_get_nth(rb, i), |
| 355 | VTY_NEWLINE); |
| 356 | |
| 357 | return CMD_SUCCESS; |
| 358 | } |
| 359 | |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 360 | gDEFUN(cfg_description, cfg_description_cmd, |
| 361 | "description .TEXT", |
Thorsten Alteholz | a81055d | 2017-03-02 22:13:48 +0100 | [diff] [blame] | 362 | "Save human-readable description of the object\n" |
Holger Hans Peter Freyther | c9b3e06 | 2012-07-25 13:02:49 +0200 | [diff] [blame] | 363 | "Text until the end of the line\n") |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 364 | { |
| 365 | char **dptr = vty->index_sub; |
| 366 | |
| 367 | if (!dptr) { |
| 368 | vty_out(vty, "vty->index_sub == NULL%s", VTY_NEWLINE); |
| 369 | return CMD_WARNING; |
| 370 | } |
| 371 | |
Holger Hans Peter Freyther | ff0670e | 2011-02-24 14:20:41 +0100 | [diff] [blame] | 372 | if (*dptr) |
| 373 | talloc_free(*dptr); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 374 | *dptr = argv_concat(argv, argc, 0); |
Holger Hans Peter Freyther | 6a75d16 | 2013-07-14 09:07:11 +0200 | [diff] [blame] | 375 | if (!*dptr) |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 376 | return CMD_WARNING; |
| 377 | |
| 378 | return CMD_SUCCESS; |
| 379 | } |
| 380 | |
| 381 | gDEFUN(cfg_no_description, cfg_no_description_cmd, |
| 382 | "no description", |
| 383 | NO_STR |
| 384 | "Remove description of the object\n") |
| 385 | { |
| 386 | char **dptr = vty->index_sub; |
| 387 | |
| 388 | if (!dptr) { |
| 389 | vty_out(vty, "vty->index_sub == NULL%s", VTY_NEWLINE); |
| 390 | return CMD_WARNING; |
| 391 | } |
| 392 | |
| 393 | if (*dptr) { |
| 394 | talloc_free(*dptr); |
| 395 | *dptr = NULL; |
| 396 | } |
| 397 | |
| 398 | return CMD_SUCCESS; |
| 399 | } |
| 400 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 401 | /* Support for configuration of log targets != the current vty */ |
| 402 | |
| 403 | struct cmd_node cfg_log_node = { |
| 404 | CFG_LOG_NODE, |
| 405 | "%s(config-log)# ", |
| 406 | 1 |
| 407 | }; |
| 408 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 409 | #ifdef HAVE_SYSLOG_H |
| 410 | |
| 411 | #include <syslog.h> |
| 412 | |
| 413 | static const int local_sysl_map[] = { |
| 414 | [0] = LOG_LOCAL0, |
| 415 | [1] = LOG_LOCAL1, |
| 416 | [2] = LOG_LOCAL2, |
| 417 | [3] = LOG_LOCAL3, |
| 418 | [4] = LOG_LOCAL4, |
| 419 | [5] = LOG_LOCAL5, |
| 420 | [6] = LOG_LOCAL6, |
| 421 | [7] = LOG_LOCAL7 |
| 422 | }; |
| 423 | |
Harald Welte | de79cee | 2011-02-24 23:47:57 +0100 | [diff] [blame] | 424 | /* From VTY core code */ |
| 425 | extern struct host host; |
| 426 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 427 | static int _cfg_log_syslog(struct vty *vty, int facility) |
| 428 | { |
| 429 | struct log_target *tgt; |
| 430 | |
| 431 | /* First delete the old syslog target, if any */ |
| 432 | tgt = log_target_find(LOG_TGT_TYPE_SYSLOG, NULL); |
| 433 | if (tgt) |
| 434 | log_target_destroy(tgt); |
| 435 | |
Harald Welte | de79cee | 2011-02-24 23:47:57 +0100 | [diff] [blame] | 436 | tgt = log_target_create_syslog(host.app_info->name, 0, facility); |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 437 | if (!tgt) { |
| 438 | vty_out(vty, "%% Unable to open syslog%s", VTY_NEWLINE); |
| 439 | return CMD_WARNING; |
| 440 | } |
| 441 | log_add_target(tgt); |
| 442 | |
| 443 | vty->index = tgt; |
| 444 | vty->node = CFG_LOG_NODE; |
| 445 | |
| 446 | return CMD_SUCCESS; |
| 447 | } |
| 448 | |
| 449 | DEFUN(cfg_log_syslog_local, cfg_log_syslog_local_cmd, |
| 450 | "log syslog local <0-7>", |
| 451 | LOG_STR "Logging via syslog\n" "Syslog LOCAL facility\n" |
| 452 | "Local facility number\n") |
| 453 | { |
| 454 | int local = atoi(argv[0]); |
| 455 | int facility = local_sysl_map[local]; |
| 456 | |
| 457 | return _cfg_log_syslog(vty, facility); |
| 458 | } |
| 459 | |
| 460 | static struct value_string sysl_level_names[] = { |
| 461 | { LOG_AUTHPRIV, "authpriv" }, |
| 462 | { LOG_CRON, "cron" }, |
| 463 | { LOG_DAEMON, "daemon" }, |
| 464 | { LOG_FTP, "ftp" }, |
| 465 | { LOG_LPR, "lpr" }, |
| 466 | { LOG_MAIL, "mail" }, |
| 467 | { LOG_NEWS, "news" }, |
| 468 | { LOG_USER, "user" }, |
| 469 | { LOG_UUCP, "uucp" }, |
| 470 | /* only for value -> string conversion */ |
| 471 | { LOG_LOCAL0, "local 0" }, |
| 472 | { LOG_LOCAL1, "local 1" }, |
| 473 | { LOG_LOCAL2, "local 2" }, |
| 474 | { LOG_LOCAL3, "local 3" }, |
| 475 | { LOG_LOCAL4, "local 4" }, |
| 476 | { LOG_LOCAL5, "local 5" }, |
| 477 | { LOG_LOCAL6, "local 6" }, |
| 478 | { LOG_LOCAL7, "local 7" }, |
| 479 | { 0, NULL } |
| 480 | }; |
| 481 | |
| 482 | DEFUN(cfg_log_syslog, cfg_log_syslog_cmd, |
| 483 | "log syslog (authpriv|cron|daemon|ftp|lpr|mail|news|user|uucp)", |
Holger Hans Peter Freyther | a4463fd | 2011-10-03 23:17:36 +0200 | [diff] [blame] | 484 | LOG_STR "Logging via syslog\n" |
| 485 | "Security/authorization messages facility\n" |
| 486 | "Clock daemon (cron/at) facility\n" |
| 487 | "General system daemon facility\n" |
| 488 | "Ftp daemon facility\n" |
| 489 | "Line printer facility\n" |
| 490 | "Mail facility\n" |
| 491 | "News facility\n" |
| 492 | "Generic facility\n" |
| 493 | "UUCP facility\n") |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 494 | { |
| 495 | int facility = get_string_value(sysl_level_names, argv[0]); |
| 496 | |
| 497 | return _cfg_log_syslog(vty, facility); |
| 498 | } |
| 499 | |
| 500 | DEFUN(cfg_no_log_syslog, cfg_no_log_syslog_cmd, |
| 501 | "no log syslog", |
| 502 | NO_STR LOG_STR "Logging via syslog\n") |
| 503 | { |
| 504 | struct log_target *tgt; |
| 505 | |
| 506 | tgt = log_target_find(LOG_TGT_TYPE_SYSLOG, NULL); |
| 507 | if (!tgt) { |
| 508 | vty_out(vty, "%% No syslog target found%s", |
| 509 | VTY_NEWLINE); |
| 510 | return CMD_WARNING; |
| 511 | } |
| 512 | |
| 513 | log_target_destroy(tgt); |
| 514 | |
| 515 | return CMD_SUCCESS; |
| 516 | } |
| 517 | #endif /* HAVE_SYSLOG_H */ |
| 518 | |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 519 | DEFUN(cfg_log_gsmtap, cfg_log_gsmtap_cmd, |
| 520 | "log gsmtap [HOSTNAME]", |
Neels Hofmeyr | fd9ec3b | 2016-12-11 01:48:26 +0100 | [diff] [blame] | 521 | LOG_STR "Logging via GSMTAP\n" |
| 522 | "Host name to send the GSMTAP logging to (UDP port 4729)\n") |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 523 | { |
| 524 | const char *hostname = argv[0]; |
| 525 | struct log_target *tgt; |
| 526 | |
| 527 | tgt = log_target_find(LOG_TGT_TYPE_GSMTAP, hostname); |
| 528 | if (!tgt) { |
| 529 | tgt = log_target_create_gsmtap(hostname, GSMTAP_UDP_PORT, |
| 530 | host.app_info->name, false, |
| 531 | true); |
| 532 | if (!tgt) { |
| 533 | vty_out(vty, "%% Unable to create GSMTAP log%s", |
| 534 | VTY_NEWLINE); |
| 535 | return CMD_WARNING; |
| 536 | } |
| 537 | log_add_target(tgt); |
| 538 | } |
| 539 | |
| 540 | vty->index = tgt; |
| 541 | vty->node = CFG_LOG_NODE; |
| 542 | |
| 543 | return CMD_SUCCESS; |
| 544 | } |
| 545 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 546 | DEFUN(cfg_log_stderr, cfg_log_stderr_cmd, |
| 547 | "log stderr", |
| 548 | LOG_STR "Logging via STDERR of the process\n") |
| 549 | { |
| 550 | struct log_target *tgt; |
| 551 | |
| 552 | tgt = log_target_find(LOG_TGT_TYPE_STDERR, NULL); |
| 553 | if (!tgt) { |
| 554 | tgt = log_target_create_stderr(); |
| 555 | if (!tgt) { |
| 556 | vty_out(vty, "%% Unable to create stderr log%s", |
| 557 | VTY_NEWLINE); |
| 558 | return CMD_WARNING; |
| 559 | } |
| 560 | log_add_target(tgt); |
| 561 | } |
| 562 | |
| 563 | vty->index = tgt; |
| 564 | vty->node = CFG_LOG_NODE; |
| 565 | |
| 566 | return CMD_SUCCESS; |
| 567 | } |
| 568 | |
| 569 | DEFUN(cfg_no_log_stderr, cfg_no_log_stderr_cmd, |
| 570 | "no log stderr", |
| 571 | NO_STR LOG_STR "Logging via STDERR of the process\n") |
| 572 | { |
| 573 | struct log_target *tgt; |
| 574 | |
| 575 | tgt = log_target_find(LOG_TGT_TYPE_STDERR, NULL); |
| 576 | if (!tgt) { |
| 577 | vty_out(vty, "%% No stderr logging active%s", VTY_NEWLINE); |
| 578 | return CMD_WARNING; |
| 579 | } |
| 580 | |
| 581 | log_target_destroy(tgt); |
| 582 | |
| 583 | return CMD_SUCCESS; |
| 584 | } |
| 585 | |
| 586 | DEFUN(cfg_log_file, cfg_log_file_cmd, |
| 587 | "log file .FILENAME", |
| 588 | LOG_STR "Logging to text file\n" "Filename\n") |
| 589 | { |
| 590 | const char *fname = argv[0]; |
| 591 | struct log_target *tgt; |
| 592 | |
| 593 | tgt = log_target_find(LOG_TGT_TYPE_FILE, fname); |
| 594 | if (!tgt) { |
| 595 | tgt = log_target_create_file(fname); |
| 596 | if (!tgt) { |
| 597 | vty_out(vty, "%% Unable to create file `%s'%s", |
| 598 | fname, VTY_NEWLINE); |
| 599 | return CMD_WARNING; |
| 600 | } |
| 601 | log_add_target(tgt); |
| 602 | } |
| 603 | |
| 604 | vty->index = tgt; |
| 605 | vty->node = CFG_LOG_NODE; |
| 606 | |
| 607 | return CMD_SUCCESS; |
| 608 | } |
| 609 | |
| 610 | |
| 611 | DEFUN(cfg_no_log_file, cfg_no_log_file_cmd, |
| 612 | "no log file .FILENAME", |
| 613 | NO_STR LOG_STR "Logging to text file\n" "Filename\n") |
| 614 | { |
| 615 | const char *fname = argv[0]; |
| 616 | struct log_target *tgt; |
| 617 | |
| 618 | tgt = log_target_find(LOG_TGT_TYPE_FILE, fname); |
| 619 | if (!tgt) { |
| 620 | vty_out(vty, "%% No such log file `%s'%s", |
| 621 | fname, VTY_NEWLINE); |
| 622 | return CMD_WARNING; |
| 623 | } |
| 624 | |
| 625 | log_target_destroy(tgt); |
| 626 | |
| 627 | return CMD_SUCCESS; |
| 628 | } |
| 629 | |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 630 | DEFUN(cfg_log_alarms, cfg_log_alarms_cmd, |
| 631 | "log alarms <2-32700>", |
| 632 | LOG_STR "Logging alarms to osmo_strrb\n" |
| 633 | "Maximum number of messages to log\n") |
| 634 | { |
| 635 | struct log_target *tgt; |
| 636 | unsigned int rbsize = atoi(argv[0]); |
| 637 | |
| 638 | tgt = log_target_find(LOG_TGT_TYPE_STRRB, NULL); |
| 639 | if (tgt) |
| 640 | log_target_destroy(tgt); |
| 641 | |
| 642 | tgt = log_target_create_rb(rbsize); |
| 643 | if (!tgt) { |
| 644 | vty_out(vty, "%% Unable to create osmo_strrb (size %u)%s", |
| 645 | rbsize, VTY_NEWLINE); |
| 646 | return CMD_WARNING; |
| 647 | } |
| 648 | log_add_target(tgt); |
| 649 | |
| 650 | vty->index = tgt; |
| 651 | vty->node = CFG_LOG_NODE; |
| 652 | |
| 653 | return CMD_SUCCESS; |
| 654 | } |
| 655 | |
| 656 | DEFUN(cfg_no_log_alarms, cfg_no_log_alarms_cmd, |
| 657 | "no log alarms", |
| 658 | NO_STR LOG_STR "Logging alarms to osmo_strrb\n") |
| 659 | { |
| 660 | struct log_target *tgt; |
| 661 | |
| 662 | tgt = log_target_find(LOG_TGT_TYPE_STRRB, NULL); |
| 663 | if (!tgt) { |
| 664 | vty_out(vty, "%% No osmo_strrb target found%s", VTY_NEWLINE); |
| 665 | return CMD_WARNING; |
| 666 | } |
| 667 | |
| 668 | log_target_destroy(tgt); |
| 669 | |
| 670 | return CMD_SUCCESS; |
| 671 | } |
| 672 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 673 | static int config_write_log_single(struct vty *vty, struct log_target *tgt) |
| 674 | { |
| 675 | int i; |
| 676 | char level_lower[32]; |
| 677 | |
| 678 | switch (tgt->type) { |
| 679 | case LOG_TGT_TYPE_VTY: |
| 680 | return 1; |
| 681 | break; |
| 682 | case LOG_TGT_TYPE_STDERR: |
| 683 | vty_out(vty, "log stderr%s", VTY_NEWLINE); |
| 684 | break; |
| 685 | case LOG_TGT_TYPE_SYSLOG: |
| 686 | #ifdef HAVE_SYSLOG_H |
| 687 | vty_out(vty, "log syslog %s%s", |
| 688 | get_value_string(sysl_level_names, |
| 689 | tgt->tgt_syslog.facility), |
| 690 | VTY_NEWLINE); |
| 691 | #endif |
| 692 | break; |
| 693 | case LOG_TGT_TYPE_FILE: |
| 694 | vty_out(vty, "log file %s%s", tgt->tgt_file.fname, VTY_NEWLINE); |
| 695 | break; |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 696 | case LOG_TGT_TYPE_STRRB: |
| 697 | vty_out(vty, "log alarms %zu%s", |
| 698 | log_target_rb_avail_size(tgt), VTY_NEWLINE); |
| 699 | break; |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 700 | case LOG_TGT_TYPE_GSMTAP: |
| 701 | vty_out(vty, "log gsmtap %s%s", |
| 702 | tgt->tgt_gsmtap.hostname, VTY_NEWLINE); |
| 703 | break; |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 704 | } |
| 705 | |
Harald Welte | 2da47f1 | 2012-10-22 19:31:54 +0200 | [diff] [blame] | 706 | vty_out(vty, " logging filter all %u%s", |
Neels Hofmeyr | 8b86cd7 | 2017-02-23 18:03:28 +0100 | [diff] [blame] | 707 | tgt->filter_map & (1 << LOG_FLT_ALL) ? 1 : 0, VTY_NEWLINE); |
Harald Welte | fb84f32 | 2013-06-06 07:33:54 +0200 | [diff] [blame] | 708 | /* save filters outside of libosmocore, i.e. in app code */ |
| 709 | if (osmo_log_info->save_fn) |
| 710 | osmo_log_info->save_fn(vty, osmo_log_info, tgt); |
Harald Welte | 2da47f1 | 2012-10-22 19:31:54 +0200 | [diff] [blame] | 711 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 712 | vty_out(vty, " logging color %u%s", tgt->use_color ? 1 : 0, |
| 713 | VTY_NEWLINE); |
Holger Hans Peter Freyther | 879acef | 2015-01-27 11:06:51 +0100 | [diff] [blame] | 714 | vty_out(vty, " logging print category %d%s", |
Michael McTernan | 7893346 | 2015-03-20 15:29:25 +0100 | [diff] [blame] | 715 | tgt->print_category ? 1 : 0, VTY_NEWLINE); |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 716 | if (tgt->print_ext_timestamp) |
| 717 | vty_out(vty, " logging print extended-timestamp 1%s", VTY_NEWLINE); |
| 718 | else |
| 719 | vty_out(vty, " logging timestamp %u%s", |
| 720 | tgt->print_timestamp ? 1 : 0, VTY_NEWLINE); |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 721 | |
| 722 | /* stupid old osmo logging API uses uppercase strings... */ |
| 723 | osmo_str2lower(level_lower, log_level_str(tgt->loglevel)); |
| 724 | vty_out(vty, " logging level all %s%s", level_lower, VTY_NEWLINE); |
| 725 | |
| 726 | for (i = 0; i < osmo_log_info->num_cat; i++) { |
| 727 | const struct log_category *cat = &tgt->categories[i]; |
| 728 | char cat_lower[32]; |
| 729 | |
Harald Welte | 1a02cfc | 2013-03-19 10:37:39 +0100 | [diff] [blame] | 730 | /* skip empty entries in the array */ |
| 731 | if (!osmo_log_info->cat[i].name) |
| 732 | continue; |
| 733 | |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 734 | /* stupid old osmo logging API uses uppercase strings... */ |
| 735 | osmo_str2lower(cat_lower, osmo_log_info->cat[i].name+1); |
| 736 | osmo_str2lower(level_lower, log_level_str(cat->loglevel)); |
| 737 | |
Max | ed0eda2 | 2017-07-06 17:09:01 +0200 | [diff] [blame] | 738 | if (strcmp(level_lower, "everything") != 0) /* FIXME: remove this check once 'everything' is phased out */ |
| 739 | vty_out(vty, " logging level %s %s%s", cat_lower, level_lower, VTY_NEWLINE); |
| 740 | else |
| 741 | LOGP(DLSTATS, LOGL_ERROR, "logging level everything is deprecated and should not be used\n"); |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 742 | } |
| 743 | |
| 744 | /* FIXME: levels */ |
| 745 | |
| 746 | return 1; |
| 747 | } |
| 748 | |
| 749 | static int config_write_log(struct vty *vty) |
| 750 | { |
| 751 | struct log_target *dbg = vty->index; |
| 752 | |
| 753 | llist_for_each_entry(dbg, &osmo_log_target_list, entry) |
| 754 | config_write_log_single(vty, dbg); |
| 755 | |
| 756 | return 1; |
| 757 | } |
| 758 | |
Max | c65c5b4 | 2017-03-15 13:20:23 +0100 | [diff] [blame] | 759 | void logging_vty_add_cmds() |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 760 | { |
| 761 | install_element_ve(&enable_logging_cmd); |
| 762 | install_element_ve(&disable_logging_cmd); |
| 763 | install_element_ve(&logging_fltr_all_cmd); |
| 764 | install_element_ve(&logging_use_clr_cmd); |
| 765 | install_element_ve(&logging_prnt_timestamp_cmd); |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 766 | install_element_ve(&logging_prnt_ext_timestamp_cmd); |
| 767 | install_element_ve(&logging_prnt_cat_cmd); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 768 | install_element_ve(&logging_set_category_mask_cmd); |
Holger Hans Peter Freyther | 146d1d3 | 2011-10-03 23:15:41 +0200 | [diff] [blame] | 769 | install_element_ve(&logging_set_category_mask_old_cmd); |
Pablo Neira Ayuso | 04139f1 | 2011-03-09 13:05:08 +0100 | [diff] [blame] | 770 | |
| 771 | /* Logging level strings are generated dynamically. */ |
Max | c65c5b4 | 2017-03-15 13:20:23 +0100 | [diff] [blame] | 772 | logging_level_cmd.string = log_vty_command_string(); |
| 773 | logging_level_cmd.doc = log_vty_command_description(); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 774 | install_element_ve(&logging_level_cmd); |
| 775 | install_element_ve(&show_logging_vty_cmd); |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 776 | install_element_ve(&show_alarms_cmd); |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 777 | |
| 778 | install_node(&cfg_log_node, config_write_log); |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 779 | install_element(CFG_LOG_NODE, &logging_fltr_all_cmd); |
| 780 | install_element(CFG_LOG_NODE, &logging_use_clr_cmd); |
| 781 | install_element(CFG_LOG_NODE, &logging_prnt_timestamp_cmd); |
Holger Hans Peter Freyther | 2d6ad13 | 2014-12-05 09:35:30 +0100 | [diff] [blame] | 782 | install_element(CFG_LOG_NODE, &logging_prnt_ext_timestamp_cmd); |
| 783 | install_element(CFG_LOG_NODE, &logging_prnt_cat_cmd); |
Harald Welte | a62648b | 2011-02-18 21:03:27 +0100 | [diff] [blame] | 784 | install_element(CFG_LOG_NODE, &logging_level_cmd); |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 785 | |
| 786 | install_element(CONFIG_NODE, &cfg_log_stderr_cmd); |
| 787 | install_element(CONFIG_NODE, &cfg_no_log_stderr_cmd); |
| 788 | install_element(CONFIG_NODE, &cfg_log_file_cmd); |
| 789 | install_element(CONFIG_NODE, &cfg_no_log_file_cmd); |
Katerina Barone-Adesi | 3309a43 | 2013-02-21 05:16:29 +0000 | [diff] [blame] | 790 | install_element(CONFIG_NODE, &cfg_log_alarms_cmd); |
| 791 | install_element(CONFIG_NODE, &cfg_no_log_alarms_cmd); |
Harald Welte | 2822296 | 2011-02-18 20:37:04 +0100 | [diff] [blame] | 792 | #ifdef HAVE_SYSLOG_H |
| 793 | install_element(CONFIG_NODE, &cfg_log_syslog_cmd); |
| 794 | install_element(CONFIG_NODE, &cfg_log_syslog_local_cmd); |
| 795 | install_element(CONFIG_NODE, &cfg_no_log_syslog_cmd); |
| 796 | #endif |
Harald Welte | aa00f99 | 2016-12-02 15:30:02 +0100 | [diff] [blame] | 797 | install_element(CONFIG_NODE, &cfg_log_gsmtap_cmd); |
Harald Welte | 3fb0b6f | 2010-05-19 19:02:52 +0200 | [diff] [blame] | 798 | } |
Harald Welte | 96e2a00 | 2017-06-12 21:44:18 +0200 | [diff] [blame] | 799 | |
| 800 | /* @} */ |