|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
25 .default_syslog_log_level = VLIB_LOG_LEVEL_WARNING,
29 .default_rate_limit = 50,
39 [VLIB_LOG_LEVEL_EMERG] = 1,
40 [VLIB_LOG_LEVEL_ALERT] = 1,
41 [VLIB_LOG_LEVEL_CRIT] = 1,
42 [VLIB_LOG_LEVEL_ERR] = 1,
43 [VLIB_LOG_LEVEL_WARNING] = 3,
44 [VLIB_LOG_LEVEL_NOTICE] = 2,
45 [VLIB_LOG_LEVEL_INFO] = 4,
46 [VLIB_LOG_LEVEL_DEBUG] = 6,
50 [VLIB_LOG_LEVEL_EMERG] = LOG_EMERG,
51 [VLIB_LOG_LEVEL_ALERT] = LOG_ALERT,
52 [VLIB_LOG_LEVEL_CRIT] = LOG_CRIT,
53 [VLIB_LOG_LEVEL_ERR] = LOG_ERR,
54 [VLIB_LOG_LEVEL_WARNING] = LOG_WARNING,
55 [VLIB_LOG_LEVEL_NOTICE] = LOG_NOTICE,
56 [VLIB_LOG_LEVEL_INFO] = LOG_INFO,
57 [VLIB_LOG_LEVEL_DEBUG] = LOG_DEBUG,
58 [VLIB_LOG_LEVEL_DISABLED] = LOG_DEBUG,
98 return format (s,
"%v",
c->name, 0);
104 u8 *v = va_arg (*args,
u8 *);
105 u32 indent = va_arg (*args,
u32);
113 for (
u32 i = 0;
i < indent;
i++)
123 if (configured == VLIB_LOG_LEVEL_DISABLED)
125 if (level > configured)
148 if ((log_enabled || syslog_enabled) == 0)
168 s =
format (s,
"--- message(s) throttled ---");
200 l =
format (l,
"\x1b[0m");
211 syslog (prio,
"%.*s: %.*s", (
int)
vec_len (l), l,
212 (
int)
vec_len (s) - is_term, s);
232 .format =
"log-%s: %s",
233 .format_args =
"t4T4",
253 ed->log_level = level;
281 str =
format (0,
"%s/%s%c",
class, subclass, 0);
300 c->name =
format (0,
"%s",
class);
305 s->
index = s -
c->subclasses;
306 s->
name = subclass ?
format (0,
"%s", subclass) : 0;
308 if (scc && scc->rate_limit != ~0)
317 if (scc && scc->level != ~0)
318 s->
level = scc->level;
319 else if (cc && cc->
level != ~0)
324 if (scc && scc->syslog_level != ~0)
335 return (
c->index << 16) | (s->
index);
360 #define _(uc,lc) case VLIB_LOG_LEVEL_##uc: t = #lc; break;
364 return format (s,
"unknown");
366 return format (s,
"%s", t);
383 if (
r->default_level)
385 if (
r->default_syslog_level)
431 .path =
"show logging",
432 .short_help =
"show logging",
456 "Class/Subclass",
"Level",
"Syslog Level",
"Rate Limit");
479 .path =
"show logging configuration",
480 .short_help =
"show logging configuration",
510 .path =
"clear logging",
511 .short_help =
"clear logging",
520 u8 *level_str = NULL;
522 if (
unformat (input,
"%s", &level_str))
525 const char __##uc[] = #lc; \
526 if (!strcmp ((const char *) level_str, __##uc)) \
528 *level = VLIB_LOG_LEVEL_##uc; \
546 u8 *class_str = NULL;
548 if (
unformat (input,
"%v", &class_str))
572 bool set_rate_limit =
false;
573 bool set_level =
false;
574 bool set_syslog_level =
false;
590 if (
unformat (line_input,
"rate-limit %d", &rate_limit))
592 set_rate_limit =
true;
605 set_syslog_level =
true;
619 subclass->
level = level;
622 if (set_syslog_level)
644 .path =
"set logging class",
645 .short_help =
"set logging class <class> [rate-limit <int>] "
646 "[level <level>] [syslog-level <level>]",
666 if (
unformat (line_input,
"%d", &unthrottle_time))
678 .path =
"set logging unthrottle-time",
679 .short_help =
"set logging unthrottle-time <int>",
714 .path =
"set logging size",
715 .short_help =
"set logging size <int>",
727 u8 *subclass_str = NULL;
728 if (
unformat (input,
"%v", &subclass_str))
766 (class->index << 16) | (subclass->index),
"%U",
772 "unknown log subclass near beginning of `%U'",
779 "unknown log class near beginning of `%U'",
794 .short_help =
"test log <level> <class> <subclass> <message>",
824 else if (
unformat (input,
"rate-limit %u", &
tmp.rate_limit))
851 else if (
unformat (input,
"default-log-level %U",
854 else if (
unformat (input,
"default-syslog-log-level %U",
858 else if (
unformat (input,
"add-to-elog"))
860 else if (
unformat (input,
"class %s %U", &
class,
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static vlib_cli_command_t cli_show_log_config
(constructor) VLIB_CLI_COMMAND (cli_show_log_config)
vlib_log_entry_t * entries
static int log_level_is_enabled(vlib_log_level_t level, vlib_log_level_t configured)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
#define UNIX_FLAG_NOCOLOR
static clib_error_t * vlib_log_init(vlib_main_t *vm)
u8 * format_indent(u8 *s, va_list *args)
#define vec_c_string_is_terminated(V)
Test whether a vector is a NULL terminated c-string.
static clib_error_t * set_log_unth_time(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
#define clib_error_return(e, args...)
static clib_error_t * show_log(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_log_level_t syslog_level
#define vec_is_equal(v1, v2)
Compare two vectors, not NULL-pointer tolerant.
static clib_error_t * set_log_class(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u8 * format_vlib_log_level(u8 *s, va_list *args)
#define hash_create_string(elts, value_bytes)
static clib_error_t * log_config(vlib_main_t *vm, unformat_input_t *input)
__clib_export u32 elog_string(elog_main_t *em, char *fmt,...)
add a string to the event-log string table
VLIB_REGISTER_LOG_CLASS(log_log, static)
vnet_hw_if_output_node_runtime_t * r
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
#define vlib_log_info(...)
#define VLIB_EARLY_CONFIG_FUNCTION(x, n,...)
static const int log_level_to_syslog_priority[]
#define UNIX_FLAG_NOSYSLOG
static vlib_cli_command_t cli_test_log
(constructor) VLIB_CLI_COMMAND (cli_test_log)
static vlib_cli_command_t cli_set_log
(constructor) VLIB_CLI_COMMAND (cli_set_log)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static vlib_cli_command_t cli_set_log_size
(constructor) VLIB_CLI_COMMAND (cli_set_log_size)
static vlib_log_subclass_data_t * get_subclass_data(vlib_log_class_t ci)
#define ELOG_TYPE_DECLARE(f)
vlib_log_class_registration_t * registrations
u32 max_class_name_length
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static vlib_cli_command_t cli_set_log_params
(constructor) VLIB_CLI_COMMAND (cli_set_log_params)
static uword unformat_vlib_log_subclass(unformat_input_t *input, va_list *args)
static vlib_cli_command_t cli_clear_log
(constructor) VLIB_CLI_COMMAND (cli_clear_log)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static_always_inline uword vlib_get_thread_index(void)
vlib_log_class_t vlib_log_register_class_rate_limit(char *class, char *subclass, u32 limit)
vlib_global_main_t vlib_global_main
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
#define hash_set_mem(h, key, value)
sll srl srl sll sra u16x4 i
#define vlib_log_debug(...)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static vlib_cli_command_t cli_show_log
(constructor) VLIB_CLI_COMMAND (cli_show_log)
static clib_error_t * test_log_class_subclass(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
uword unformat_vlib_cli_sub_input(unformat_input_t *i, va_list *args)
static clib_error_t * set_log_size(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
uword * config_index_by_name
static_always_inline void clib_memset_u8(void *p, u8 val, uword count)
vlib_log_class_data_t * classes
#define vec_free(V)
Free vector's memory (no header).
#define hash_get_mem(h, key)
static uword unformat_vlib_log_class(unformat_input_t *input, va_list *args)
static uword unformat_vlib_log_level(unformat_input_t *input, va_list *args)
description fragment has unexpected format
static vlib_log_class_t vlib_log_register_class_internal(char *class, char *subclass, u32 limit)
#define VLIB_INIT_FUNCTION(x)
struct timeval time_zero_timeval
#define vec_foreach(var, vec)
Vector iterator.
vlib_log_level_t syslog_level
void vlib_log(vlib_log_level_t level, vlib_log_class_t class, char *fmt,...)
int default_syslog_log_level
static const int colors[]
static vlib_main_t * vlib_get_main(void)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define vec_terminate_c_string(V)
(If necessary) NULL terminate a vector containing a c-string.
static clib_error_t * show_log_config(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define UNIX_FLAG_INTERACTIVE
static vlib_log_class_data_t * get_class_data(vlib_log_class_t ci)
static f64 vlib_time_now(vlib_main_t *vm)
static clib_error_t * log_config_class(vlib_main_t *vm, char *name, unformat_input_t *input)
static clib_error_t * clear_log(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define foreach_vlib_log_level
u8 * format_vlib_log_class(u8 *s, va_list *args)
vlib_log_class_config_t * configs