FD.io VPP  v21.06-3-gbb25fbf28
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...
 

Detailed Description

RFC5424 syslog protocol implementation

Definition in file syslog.c.

Macro Definition Documentation

◆ DEFAULT_MAX_MSG_SIZE

#define DEFAULT_MAX_MSG_SIZE   480

Definition at line 29 of file syslog.c.

◆ DEFAULT_UDP_PORT

#define DEFAULT_UDP_PORT   514

Definition at line 28 of file syslog.c.

◆ encode_priority

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

Definition at line 31 of file syslog.c.

◆ NILVALUE

#define NILVALUE   "-"

Definition at line 27 of file syslog.c.

◆ SYSLOG_VERSION

#define SYSLOG_VERSION   "1"

Definition at line 26 of file syslog.c.

Function Documentation

◆ format_syslog_header()

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

Definition at line 53 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 86 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 229 of file syslog.c.

+ 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 68 of file syslog.c.

+ 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 37 of file syslog.c.

+ 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 467 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 247 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 281 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 498 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 354 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 605 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 129 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 111 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 143 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 101 of file syslog.c.

+ 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 376 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 199 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 214 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>",
}

(constructor) VLIB_CLI_COMMAND (set_syslog_filter_command)

Definition at line 579 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>]",
}

(constructor) VLIB_CLI_COMMAND (set_syslog_sender_command)

Definition at line 520 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",
}

(constructor) VLIB_CLI_COMMAND (show_syslog_filter_command)

Definition at line 597 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",
}

(constructor) VLIB_CLI_COMMAND (show_syslog_sender_command)

Definition at line 541 of file syslog.c.

◆ syslog_main

syslog_main_t syslog_main

Definition at line 33 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]",
}

(constructor) VLIB_CLI_COMMAND (test_syslog_command)

Definition at line 562 of file syslog.c.

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)
Definition: syslog.c:467
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)
Definition: syslog.c:498
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)
Definition: syslog.c:354
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)
Definition: syslog.c:281
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)
Definition: syslog.c:376