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