libosmovty  0.9.6.20170825
Osmocom VTY library
Osmocom logging framework

Configuration of logging from VTY. More...

Macros

#define SHOW_LOG_STR   "Show current logging configuration\n"
 

Typedefs

typedef int log_filter(const struct log_context *ctx, struct log_target *target)
 
typedef void log_print_filters(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
 
typedef void log_save_filters(struct vty *vty, const struct log_info *info, const struct log_target *tgt)
 

Enumerations

enum  log_ctx_index
 
enum  log_filter_index
 
enum  log_target_type
 

Functions

void osmo_vlogp (int subsys, int level, const char *file, int line, int cont, const char *format, va_list ap)
 
void logp (int subsys, const char *file, int line, int cont, const char *format,...) OSMO_DEPRECATED("Use DEBUGP* macros instead")
 
void logp2 (int subsys, unsigned int level, const char *file, int line, int cont, const char *format,...) __attribute__((format(printf
 
void int log_init (const struct log_info *inf, void *talloc_ctx)
 
void log_fini (void)
 
int log_check_level (int subsys, unsigned int level)
 
void log_reset_context (void)
 
int log_set_context (uint8_t ctx, void *value)
 
void log_set_all_filter (struct log_target *target, int)
 
void log_set_use_color (struct log_target *target, int)
 
void log_set_print_extended_timestamp (struct log_target *target, int)
 
void log_set_print_timestamp (struct log_target *target, int)
 
void log_set_print_filename (struct log_target *target, int)
 
void log_set_print_category (struct log_target *target, int)
 
void log_set_log_level (struct log_target *target, int log_level)
 
void log_parse_category_mask (struct log_target *target, const char *mask)
 
const char * log_category_name (int subsys)
 
int log_parse_level (const char *lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
 
const char * log_level_str (unsigned int lvl) OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
 
int log_parse_category (const char *category)
 
void log_set_category_filter (struct log_target *target, int category, int enable, int level)
 
struct log_targetlog_target_create (void)
 
void log_target_destroy (struct log_target *target)
 
struct log_targetlog_target_create_stderr (void)
 
struct log_targetlog_target_create_file (const char *fname)
 
struct log_targetlog_target_create_syslog (const char *ident, int option, int facility)
 
struct log_targetlog_target_create_gsmtap (const char *host, uint16_t port, const char *ident, bool ofd_wq_mode, bool add_sink)
 
int log_target_file_reopen (struct log_target *tgt)
 
int log_targets_reopen (void)
 
void log_add_target (struct log_target *target)
 
void log_del_target (struct log_target *target)
 
const char * log_vty_command_string () OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
 
const char * log_vty_command_description () OSMO_DEPRECATED_OUTSIDE_LIBOSMOCORE
 
struct log_targetlog_target_find (int type, const char *fname)
 
static void _gsmtap_raw_output (struct log_target *target, int subsys, unsigned int level, const char *file, int line, int cont, const char *format, va_list ap)
 
static int logp2syslog_level (unsigned int level)
 
static void _syslog_output (struct log_target *target, unsigned int level, const char *log)
 
static void _rb_output (struct log_target *target, unsigned int level, const char *log)
 
size_t log_target_rb_used_size (struct log_target const *target)
 
size_t log_target_rb_avail_size (struct log_target const *target)
 
const char * log_target_rb_get (struct log_target const *target, size_t logindex)
 
struct log_targetlog_target_create_rb (size_t size)
 
static void _vty_output (struct log_target *tgt, unsigned int level, const char *line)
 
struct log_targetlog_target_create_vty (struct vty *vty)
 
 DEFUN (enable_logging, enable_logging_cmd,"logging enable", LOGGING_STR"Enables logging to this vty\n")
 
struct log_targetosmo_log_vty2tgt (struct vty *vty)
 
 DEFUN (logging_fltr_all, logging_fltr_all_cmd,"logging filter all (0|1)", LOGGING_STR FILTER_STR"Do you want to log all messages?\n""Only print messages matched by other filters\n""Bypass filter and print all messages\n")
 
 DEFUN (logging_use_clr, logging_use_clr_cmd,"logging color (0|1)", LOGGING_STR"Configure color-printing for log messages\n""Don't use color for printing messages\n""Use color for printing messages\n")
 
 DEFUN (logging_prnt_timestamp, logging_prnt_timestamp_cmd,"logging timestamp (0|1)", LOGGING_STR"Configure log message timestamping\n""Don't prefix each log message\n""Prefix each log message with current timestamp\n")
 
 DEFUN (logging_prnt_ext_timestamp, logging_prnt_ext_timestamp_cmd,"logging print extended-timestamp (0|1)", LOGGING_STR"Log output settings\n""Configure log message timestamping\n""Don't prefix each log message\n""Prefix each log message with current timestamp with YYYYMMDDhhmmssnnn\n")
 
 DEFUN (logging_prnt_cat, logging_prnt_cat_cmd,"logging print category (0|1)", LOGGING_STR"Log output settings\n""Configure log message\n""Don't prefix each log message\n""Prefix each log message with category/subsystem name\n")
 
 DEFUN (logging_level, logging_level_cmd, NULL, NULL)
 
 DEFUN (logging_set_category_mask, logging_set_category_mask_cmd,"logging set-log-mask MASK", LOGGING_STR"Set the logmask of this logging target\n""The logmask to use\n")
 
 ALIAS_DEPRECATED (logging_set_category_mask, logging_set_category_mask_old_cmd,"logging set log mask MASK", LOGGING_STR"Decide which categories to output.\n""Log commands\n""Mask commands\n""The logmask to use\n")
 
 DEFUN (diable_logging, disable_logging_cmd,"logging disable", LOGGING_STR"Disables logging to this vty\n")
 
static void vty_print_logtarget (struct vty *vty, const struct log_info *info, const struct log_target *tgt)
 
 DEFUN (show_logging_vty, show_logging_vty_cmd,"show logging vty", SHOW_STR SHOW_LOG_STR"Show current logging configuration for this vty\n")
 
 DEFUN (show_alarms, show_alarms_cmd,"show alarms", SHOW_STR SHOW_LOG_STR"Show the contents of the logging ringbuffer\n")
 
 gDEFUN (cfg_description, cfg_description_cmd,"description .TEXT","Save human-readable description of the object\n""Text until the end of the line\n")
 
 gDEFUN (cfg_no_description, cfg_no_description_cmd,"no description", NO_STR"Remove description of the object\n")
 
static int _cfg_log_syslog (struct vty *vty, int facility)
 
 DEFUN (cfg_log_syslog_local, cfg_log_syslog_local_cmd,"log syslog local <0-7>", LOG_STR"Logging via syslog\n""Syslog LOCAL facility\n""Local facility number\n")
 
 DEFUN (cfg_log_syslog, cfg_log_syslog_cmd,"log syslog (authpriv|cron|daemon|ftp|lpr|mail|news|user|uucp)", LOG_STR"Logging via syslog\n""Security/authorization messages facility\n""Clock daemon (cron/at) facility\n""General system daemon facility\n""Ftp daemon facility\n""Line printer facility\n""Mail facility\n""News facility\n""Generic facility\n""UUCP facility\n")
 
 DEFUN (cfg_no_log_syslog, cfg_no_log_syslog_cmd,"no log syslog", NO_STR LOG_STR"Logging via syslog\n")
 
 DEFUN (cfg_log_gsmtap, cfg_log_gsmtap_cmd,"log gsmtap [HOSTNAME]", LOG_STR"Logging via GSMTAP\n""Host name to send the GSMTAP logging to (UDP port 4729)\n")
 
 DEFUN (cfg_log_stderr, cfg_log_stderr_cmd,"log stderr", LOG_STR"Logging via STDERR of the process\n")
 
 DEFUN (cfg_no_log_stderr, cfg_no_log_stderr_cmd,"no log stderr", NO_STR LOG_STR"Logging via STDERR of the process\n")
 
 DEFUN (cfg_log_file, cfg_log_file_cmd,"log file .FILENAME", LOG_STR"Logging to text file\n""Filename\n")
 
 DEFUN (cfg_no_log_file, cfg_no_log_file_cmd,"no log file .FILENAME", NO_STR LOG_STR"Logging to text file\n""Filename\n")
 
 DEFUN (cfg_log_alarms, cfg_log_alarms_cmd,"log alarms <2-32700>", LOG_STR"Logging alarms to osmo_strrb\n""Maximum number of messages to log\n")
 
 DEFUN (cfg_no_log_alarms, cfg_no_log_alarms_cmd,"no log alarms", NO_STR LOG_STR"Logging alarms to osmo_strrb\n")
 
static int config_write_log_single (struct vty *vty, struct log_target *tgt)
 
static int config_write_log (struct vty *vty)
 
void logging_vty_add_cmds ()
 

Variables

 LOG_CTX_GB_NSVC
 
 LOG_CTX_GB_BVC
 
 LOG_CTX_BSC_SUBSCR
 
 LOG_CTX_VLR_SUBSCR
 
 _LOG_CTX_COUNT
 
 LOG_FLT_ALL
 
 LOG_FLT_GB_NSVC
 
 LOG_FLT_GB_BVC
 
 LOG_FLT_BSC_SUBSCR
 
 LOG_FLT_VLR_SUBSCR
 
 _LOG_FLT_COUNT
 
 LOG_TGT_TYPE_VTY
 
 LOG_TGT_TYPE_SYSLOG
 
 LOG_TGT_TYPE_FILE
 
 LOG_TGT_TYPE_STDERR
 
 LOG_TGT_TYPE_STRRB
 
 LOG_TGT_TYPE_GSMTAP
 
struct llist_head osmo_log_target_list
 
const struct log_infoosmo_log_info
 
struct cmd_node cfg_log_node
 
static const int local_sysl_map []
 
struct host host
 
static struct value_string sysl_level_names []
 

Detailed Description

Configuration of logging from VTY.

This module implements functions that permit configuration of the libosmocore logging framework from VTY commands. This applies both to logging to the VTY (telnet sessions), as well as logging to other targets, such as sysslog, file, gsmtap, ...

Macro Definition Documentation

#define SHOW_LOG_STR   "Show current logging configuration\n"

Function Documentation

static void _vty_output ( struct log_target tgt,
unsigned int  level,
const char *  line 
)
static

References log_target::tgt_vty, and vty_out().

Referenced by log_target_create_vty().

ALIAS_DEPRECATED ( logging_set_category_mask  ,
logging_set_category_mask_old_cmd  ,
"logging set log mask MASK"  ,
LOGGING_STR"Decide which categories to output.\n""Log commands\n""Mask commands\n""The logmask to use\n  
)

Referenced by DEFUN().

static int config_write_log ( struct vty vty)
static
DEFUN ( enable_logging  ,
enable_logging_cmd  ,
"logging enable"  ,
LOGGING_STR"Enables logging to this vty\n  
)
DEFUN ( logging_fltr_all  ,
logging_fltr_all_cmd  ,
"logging filter all (0|1)"  ,
LOGGING_STR FILTER_STR"Do you want to log all messages?\n""Only print messages matched by other filters\n""Bypass filter and print all messages\n  
)
DEFUN ( logging_use_clr  ,
logging_use_clr_cmd  ,
"logging color (0|1)"  ,
LOGGING_STR"Configure color-printing for log messages\n""Don't use color for printing messages\n""Use color for printing messages\n  
)
DEFUN ( logging_prnt_timestamp  ,
logging_prnt_timestamp_cmd  ,
"logging timestamp (0|1)"  ,
LOGGING_STR"Configure log message timestamping\n""Don't prefix each log message\n""Prefix each log message with current timestamp\n  
)
DEFUN ( logging_prnt_ext_timestamp  ,
logging_prnt_ext_timestamp_cmd  ,
"logging print extended-timestamp (0|1)"  ,
LOGGING_STR"Log output settings\n""Configure log message timestamping\n""Don't prefix each log message\n""Prefix each log message with current timestamp with YYYYMMDDhhmmssnnn\n  
)
DEFUN ( logging_prnt_cat  ,
logging_prnt_cat_cmd  ,
"logging print category (0|1)"  ,
LOGGING_STR"Log output settings\n""Configure log message\n""Don't prefix each log message\n""Prefix each log message with category/subsystem name\n  
)
DEFUN ( logging_set_category_mask  ,
logging_set_category_mask_cmd  ,
"logging set-log-mask MASK"  ,
LOGGING_STR"Set the logmask of this logging target\n""The logmask to use\n  
)
DEFUN ( diable_logging  ,
disable_logging_cmd  ,
"logging disable"  ,
LOGGING_STR"Disables logging to this vty\n  
)
DEFUN ( show_logging_vty  ,
show_logging_vty_cmd  ,
"show logging vty ,
SHOW_STR SHOW_LOG_STR"Show current logging configuration for this vty\n  
)
DEFUN ( show_alarms  ,
show_alarms_cmd  ,
"show alarms"  ,
SHOW_STR SHOW_LOG_STR"Show the contents of the logging ringbuffer\n  
)
DEFUN ( cfg_log_syslog_local  ,
cfg_log_syslog_local_cmd  ,
"log syslog local <0-7>"  ,
LOG_STR"Logging via syslog\n""Syslog LOCAL facility\n""Local facility number\n  
)
DEFUN ( cfg_log_syslog  ,
cfg_log_syslog_cmd  ,
"log syslog (authpriv|cron|daemon|ftp|lpr|mail|news|user|uucp)"  ,
LOG_STR"Logging via syslog\n""Security/authorization messages facility\n""Clock daemon (cron/at) facility\n""General system daemon facility\n""Ftp daemon facility\n""Line printer facility\n""Mail facility\n""News facility\n""Generic facility\n""UUCP facility\n  
)
DEFUN ( cfg_no_log_syslog  ,
cfg_no_log_syslog_cmd  ,
"no log syslog"  ,
NO_STR LOG_STR"Logging via syslog\n  
)
DEFUN ( cfg_log_gsmtap  ,
cfg_log_gsmtap_cmd  ,
"log gsmtap "  [HOSTNAME],
LOG_STR"Logging via GSMTAP\n""Host name to send the GSMTAP logging to (UDP port 4729)\n  
)
DEFUN ( cfg_log_stderr  ,
cfg_log_stderr_cmd  ,
"log stderr"  ,
LOG_STR"Logging via STDERR of the process\n  
)
DEFUN ( cfg_no_log_stderr  ,
cfg_no_log_stderr_cmd  ,
"no log stderr"  ,
NO_STR LOG_STR"Logging via STDERR of the process\n  
)
DEFUN ( cfg_log_file  ,
cfg_log_file_cmd  ,
"log file .FILENAME"  ,
LOG_STR"Logging to text file\n""Filename\n  
)
DEFUN ( cfg_no_log_file  ,
cfg_no_log_file_cmd  ,
"no log file .FILENAME"  ,
NO_STR LOG_STR"Logging to text file\n""Filename\n  
)
DEFUN ( cfg_log_alarms  ,
cfg_log_alarms_cmd  ,
"log alarms <2-32700>"  ,
LOG_STR"Logging alarms to osmo_strrb\n""Maximum number of messages to log\n  
)
DEFUN ( cfg_no_log_alarms  ,
cfg_no_log_alarms_cmd  ,
"no log alarms"  ,
NO_STR LOG_STR"Logging alarms to osmo_strrb\n  
)
gDEFUN ( cfg_description  ,
cfg_description_cmd  ,
"description .TEXT"  ,
"Save human-readable description of the object\n""Text until the end of the line\n  
)
gDEFUN ( cfg_no_description  ,
cfg_no_description_cmd  ,
"no description"  ,
NO_STR"Remove description of the object\n  
)
struct log_target* log_target_create_vty ( struct vty vty)
struct log_target* osmo_log_vty2tgt ( struct vty vty)

Variable Documentation

struct cmd_node cfg_log_node
Initial value:
= {
"%s(config-log)# ",
1
}
Configure the logging.
Definition: command.h:77
struct host host
const int local_sysl_map[]
static
Initial value:
= {
[0] = LOG_LOCAL0,
[1] = LOG_LOCAL1,
[2] = LOG_LOCAL2,
[3] = LOG_LOCAL3,
[4] = LOG_LOCAL4,
[5] = LOG_LOCAL5,
[6] = LOG_LOCAL6,
[7] = LOG_LOCAL7
}

Referenced by DEFUN().

const struct log_info* osmo_log_info
struct value_string sysl_level_names[]
static
Initial value:
= {
{ LOG_AUTHPRIV, "authpriv" },
{ LOG_CRON, "cron" },
{ LOG_DAEMON, "daemon" },
{ LOG_FTP, "ftp" },
{ LOG_LPR, "lpr" },
{ LOG_MAIL, "mail" },
{ LOG_NEWS, "news" },
{ LOG_USER, "user" },
{ LOG_UUCP, "uucp" },
{ LOG_LOCAL0, "local 0" },
{ LOG_LOCAL1, "local 1" },
{ LOG_LOCAL2, "local 2" },
{ LOG_LOCAL3, "local 3" },
{ LOG_LOCAL4, "local 4" },
{ LOG_LOCAL5, "local 5" },
{ LOG_LOCAL6, "local 6" },
{ LOG_LOCAL7, "local 7" },
{ 0, NULL }
}