FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
syslog.c File Reference
+ Include dependency graph for syslog.c:

Go to the source code of this file.

Macros

#define SYSLOG_VERSION   "1"
 
#define NILVALUE   "-"
 
#define DEFAULT_UDP_PORT   514
 
#define DEFAULT_MAX_MSG_SIZE   480
 
#define encode_priority(f, p)   ((f << 3) | p)
 

Functions

static u8format_syslog_timestamp (u8 *s, va_list *args)
 
static u8format_syslog_header (u8 *s, va_list *args)
 
static u8format_syslog_structured_data (u8 *s, va_list *args)
 
static u8format_syslog_msg (u8 *s, va_list *args)
 
void syslog_msg_sd_init (syslog_msg_t *syslog_msg, char *sd_id)
 Initialize structured data element. More...
 
void syslog_msg_add_sd_param (syslog_msg_t *syslog_msg, char *name, char *fmt,...)
 Add structured data elemnt parameter name-value pair RFC5424 6.3.3. More...
 
void syslog_msg_add_msg (syslog_msg_t *syslog_msg, char *fmt,...)
 Add free-form message RFC5424 6.4. More...
 
void syslog_msg_init (syslog_msg_t *syslog_msg, syslog_facility_t facility, syslog_severity_t severity, char *app_name, char *msgid)
 Initialize syslog message header. More...
 
int syslog_msg_send (syslog_msg_t *syslog_msg)
 Send syslog message. More...
 
static uword unformat_syslog_facility (unformat_input_t *input, va_list *args)
 
static uword unformat_syslog_severity (unformat_input_t *input, va_list *args)
 
static u8format_syslog_severity (u8 *s, va_list *args)
 
vnet_api_error_t set_syslog_sender (ip4_address_t *collector, u16 collector_port, ip4_address_t *src, u32 vrf_id, u32 max_msg_size)
 Set syslog sender configuration. More...
 
static clib_error_tset_syslog_sender_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tshow_syslog_sender_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_ttest_syslog_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tset_syslog_filter_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tshow_syslog_filter_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tsyslog_init (vlib_main_t *vm)
 

Variables

syslog_main_t syslog_main
 
static vlib_cli_command_t set_syslog_sender_command
 (constructor) VLIB_CLI_COMMAND (set_syslog_sender_command) More...
 
static vlib_cli_command_t show_syslog_sender_command
 (constructor) VLIB_CLI_COMMAND (show_syslog_sender_command) More...
 
static vlib_cli_command_t test_syslog_command
 (constructor) VLIB_CLI_COMMAND (test_syslog_command) More...
 
static vlib_cli_command_t set_syslog_filter_command
 (constructor) VLIB_CLI_COMMAND (set_syslog_filter_command) More...
 
static vlib_cli_command_t show_syslog_filter_command
 (constructor) VLIB_CLI_COMMAND (show_syslog_filter_command) More...
 

Macro Definition Documentation

◆ DEFAULT_MAX_MSG_SIZE

#define DEFAULT_MAX_MSG_SIZE   480

Definition at line 28 of file syslog.c.

◆ DEFAULT_UDP_PORT

#define DEFAULT_UDP_PORT   514

Definition at line 27 of file syslog.c.

◆ encode_priority

#define encode_priority (   f,
 
)    ((f << 3) | p)

Definition at line 30 of file syslog.c.

◆ NILVALUE

#define NILVALUE   "-"

Definition at line 26 of file syslog.c.

◆ SYSLOG_VERSION

#define SYSLOG_VERSION   "1"

Definition at line 25 of file syslog.c.

Function Documentation

◆ format_syslog_header()

static u8* format_syslog_header ( u8 s,
va_list *  args 
)
static

Definition at line 52 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_syslog_msg()

static u8* format_syslog_msg ( u8 s,
va_list *  args 
)
static

Definition at line 85 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_syslog_severity()

static u8* format_syslog_severity ( u8 s,
va_list *  args 
)
static

Definition at line 234 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_syslog_structured_data()

static u8* format_syslog_structured_data ( u8 s,
va_list *  args 
)
static

Definition at line 67 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_syslog_timestamp()

static u8* format_syslog_timestamp ( u8 s,
va_list *  args 
)
static

Definition at line 36 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_syslog_filter_command_fn()

static clib_error_t* set_syslog_filter_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 472 of file syslog.c.

+ Here is the call graph for this function:

◆ set_syslog_sender()

vnet_api_error_t set_syslog_sender ( ip4_address_t collector,
u16  collector_port,
ip4_address_t src,
u32  vrf_id,
u32  max_msg_size 
)

Set syslog sender configuration.

Parameters
collectorIPv4 address of syslog collector (destination)
collector_portUDP port of syslog colector (destination)
srcIPv4 address of syslog sender (source)
vrf_idVRF/FIB table ID
max_msg_sizemaximum message length

Definition at line 252 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_syslog_sender_command_fn()

static clib_error_t* set_syslog_sender_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 286 of file syslog.c.

+ Here is the call graph for this function:

◆ show_syslog_filter_command_fn()

static clib_error_t* show_syslog_filter_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 503 of file syslog.c.

+ Here is the call graph for this function:

◆ show_syslog_sender_command_fn()

static clib_error_t* show_syslog_sender_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 359 of file syslog.c.

+ Here is the call graph for this function:

◆ syslog_init()

static clib_error_t* syslog_init ( vlib_main_t vm)
static

Definition at line 610 of file syslog.c.

+ Here is the call graph for this function:

◆ syslog_msg_add_msg()

void syslog_msg_add_msg ( syslog_msg_t syslog_msg,
char *  fmt,
  ... 
)

Add free-form message RFC5424 6.4.

Definition at line 128 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syslog_msg_add_sd_param()

void syslog_msg_add_sd_param ( syslog_msg_t syslog_msg,
char *  name,
char *  fmt,
  ... 
)

Add structured data elemnt parameter name-value pair RFC5424 6.3.3.

Definition at line 110 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syslog_msg_init()

void syslog_msg_init ( syslog_msg_t syslog_msg,
syslog_facility_t  facility,
syslog_severity_t  severity,
char *  app_name,
char *  msgid 
)

Initialize syslog message header.

Parameters
facilityfacility value
severityseverity level
app_nameapplication that originated message RFC424 6.2.5. (optional)
msgididentify the type of message RFC5424 6.2.7. (optional)

Definition at line 142 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syslog_msg_sd_init()

void syslog_msg_sd_init ( syslog_msg_t syslog_msg,
char *  sd_id 
)

Initialize structured data element.

Parameters
sd_idstructured data element name RFC5424 6.3.2.

Definition at line 100 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syslog_msg_send()

int syslog_msg_send ( syslog_msg_t syslog_msg)

Send syslog message.

Definition at line 159 of file syslog.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_syslog_command_fn()

static clib_error_t* test_syslog_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 381 of file syslog.c.

+ Here is the call graph for this function:

◆ unformat_syslog_facility()

static uword unformat_syslog_facility ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 204 of file syslog.c.

+ Here is the caller graph for this function:

◆ unformat_syslog_severity()

static uword unformat_syslog_severity ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 219 of file syslog.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ set_syslog_filter_command

vlib_cli_command_t set_syslog_filter_command
static
Initial value:
= {
.path = "set syslog filter",
.short_help = "set syslog filter severity <severity>",
}
static clib_error_t * set_syslog_filter_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: syslog.c:472

(constructor) VLIB_CLI_COMMAND (set_syslog_filter_command)

Definition at line 584 of file syslog.c.

◆ set_syslog_sender_command

vlib_cli_command_t set_syslog_sender_command
static
Initial value:
= {
.path = "set syslog sender",
.short_help = "set syslog sender "
"collector <ip4-address> [port <port>] "
"src <ip4-address> [vrf-id <vrf-id>] "
"[max-msg-size <max-msg-size>]",
}
static clib_error_t * set_syslog_sender_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: syslog.c:286

(constructor) VLIB_CLI_COMMAND (set_syslog_sender_command)

Definition at line 525 of file syslog.c.

◆ show_syslog_filter_command

vlib_cli_command_t show_syslog_filter_command
static
Initial value:
= {
.path = "show syslog filter",
.short_help = "show syslog filter",
}
static clib_error_t * show_syslog_filter_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: syslog.c:503

(constructor) VLIB_CLI_COMMAND (show_syslog_filter_command)

Definition at line 602 of file syslog.c.

◆ show_syslog_sender_command

vlib_cli_command_t show_syslog_sender_command
static
Initial value:
= {
.path = "show syslog sender",
.short_help = "show syslog sender",
}
static clib_error_t * show_syslog_sender_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: syslog.c:359

(constructor) VLIB_CLI_COMMAND (show_syslog_sender_command)

Definition at line 546 of file syslog.c.

◆ syslog_main

syslog_main_t syslog_main

Definition at line 32 of file syslog.c.

◆ test_syslog_command

vlib_cli_command_t test_syslog_command
static
Initial value:
= {
.path = "test syslog",
.short_help = "test syslog <facility> <severity> <app-name> <msgid> "
"[sd-id <sd-id> sd-param <name> <value>] [<message]",
}
static clib_error_t * test_syslog_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: syslog.c:381

(constructor) VLIB_CLI_COMMAND (test_syslog_command)

Definition at line 567 of file syslog.c.