FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
syslog.h File Reference

RFC5424 syslog protocol declarations. More...

+ Include dependency graph for syslog.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  syslog_header_t
 syslog header More...
 
struct  syslog_msg_t
 syslog message More...
 
struct  syslog_main_t
 

Macros

#define foreach_syslog_facility
 
#define foreach_syslog_severity
 

Enumerations

enum  syslog_facility_t { foreach_syslog_facility }
 
enum  syslog_severity_t { foreach_syslog_severity }
 

Functions

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...
 
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...
 
int syslog_msg_send (syslog_msg_t *syslog_msg)
 Send syslog message. More...
 
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 int syslog_is_enabled (void)
 Check if syslog logging is enabled. More...
 
static int syslog_severity_filter_block (syslog_severity_t s)
 Severity filter test. More...
 

Variables

syslog_main_t syslog_main
 

Detailed Description

RFC5424 syslog protocol declarations.

Definition in file syslog.h.

Macro Definition Documentation

◆ foreach_syslog_facility

#define foreach_syslog_facility
Value:
_(0, KERNEL, "kernel") \
_(1, USER_LEVEL, "user-level") \
_(2, MAIL_SYSTEM, "mail-system") \
_(3, SYSTEM_DAEMONS, "system-daemons") \
_(4, SEC_AUTH, "security-authorization") \
_(5, SYSLOGD, "syslogd") \
_(6, LINE_PRINTER, "line-printer") \
_(7, NETWORK_NEWS, "network-news") \
_(8, UUCP, "uucp") \
_(9, CLOCK, "clock-daemon") \
_(11, FTP, "ftp-daemon") \
_(12, NTP, "ntp-subsystem") \
_(13, LOG_AUDIT, "log-audit") \
_(14, LOG_ALERT, "log-alert") \
_(16, LOCAL0, "local0") \
_(17, LOCAL1, "local1") \
_(18, LOCAL2, "local2") \
_(19, LOCAL3, "local3") \
_(20, LOCAL4, "local4") \
_(21, LOCAL5, "local5") \
_(22, LOCAL6, "local6") \
_(23, LOCAL7, "local7")

Definition at line 27 of file syslog.h.

◆ foreach_syslog_severity

#define foreach_syslog_severity
Value:
_(0, EMERGENCY, "emergency") \
_(1, ALERT, "alert") \
_(2, CRITICAL, "critical") \
_(3, ERROR, "error") \
_(4, WARNING, "warning") \
_(5, NOTICE, "notice") \
_(6, INFORMATIONAL, "informational") \
_(7, DEBUG, "debug")
#define DEBUG
Definition: dlmalloc.c:33

Definition at line 59 of file syslog.h.

Enumeration Type Documentation

◆ syslog_facility_t

Enumerator
foreach_syslog_facility 

Definition at line 51 of file syslog.h.

◆ syslog_severity_t

Enumerator
foreach_syslog_severity 

Definition at line 69 of file syslog.h.

Function Documentation

◆ 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 249 of file syslog.c.

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

◆ syslog_is_enabled()

static int syslog_is_enabled ( void  )
inlinestatic

Check if syslog logging is enabled.

Returns
1 if syslog logging is enabled, 0 otherwise

Definition at line 198 of file syslog.h.

+ Here is the caller 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 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 160 of file syslog.c.

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

◆ syslog_severity_filter_block()

static int syslog_severity_filter_block ( syslog_severity_t  s)
inlinestatic

Severity filter test.

Returns
1 if message with specified severity is not selected to be logged

Definition at line 211 of file syslog.h.

+ Here is the caller graph for this function:

Variable Documentation

◆ syslog_main

syslog_main_t syslog_main

Definition at line 33 of file syslog.c.