syslog-ng source
evtlog.h File Reference
#include <syslog.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <glib.h>
#include "evtmaps.h"
Include dependency graph for evtlog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EVT_PRI_EMERG   0 /* system is unusable */
 
#define EVT_PRI_ALERT   1 /* action must be taken immediately */
 
#define EVT_PRI_CRIT   2 /* critical conditions */
 
#define EVT_PRI_ERR   3 /* error conditions */
 
#define EVT_PRI_WARNING   4 /* warning conditions */
 
#define EVT_PRI_NOTICE   5 /* normal but significant condition */
 
#define EVT_PRI_INFO   6 /* informational */
 
#define EVT_PRI_DEBUG   7 /* debug-level messages */
 
#define EVT_FAC_KERN   (0<<3) /* kernel messages */
 
#define EVT_FAC_USER   (1<<3) /* random user-level messages */
 
#define EVT_FAC_MAIL   (2<<3) /* mail system */
 
#define EVT_FAC_DAEMON   (3<<3) /* system daemons */
 
#define EVT_FAC_AUTH   (4<<3) /* security/authorization messages */
 
#define EVT_FAC_SYSLOG   (5<<3) /* messages generated internally by syslogd */
 
#define EVT_FAC_LPR   (6<<3) /* line printer subsystem */
 
#define EVT_FAC_NEWS   (7<<3) /* network news subsystem */
 
#define EVT_FAC_UUCP   (8<<3) /* UUCP subsystem */
 
#define EVT_FAC_CRON   (9<<3) /* clock daemon */
 
#define EVT_FAC_AUTHPRIV   (10<<3) /* security/authorization messages (private) */
 
#define EVT_FAC_FTP   (11<<3) /* ftp daemon */
 
#define EVT_FAC_LOCAL0   (16<<3) /* reserved for local use */
 
#define EVT_FAC_LOCAL1   (17<<3) /* reserved for local use */
 
#define EVT_FAC_LOCAL2   (18<<3) /* reserved for local use */
 
#define EVT_FAC_LOCAL3   (19<<3) /* reserved for local use */
 
#define EVT_FAC_LOCAL4   (20<<3) /* reserved for local use */
 
#define EVT_FAC_LOCAL5   (21<<3) /* reserved for local use */
 
#define EVT_FAC_LOCAL6   (22<<3) /* reserved for local use */
 
#define EVT_FAC_LOCAL7   (23<<3) /* reserved for local use */
 

Functions

EVTCONTEXT * evt_ctx_init (const char *prog, int syslog_fac)
 
void evt_ctx_free (EVTCONTEXT *ctx)
 
int evt_ctx_tag_hook_add (EVTCONTEXT *ctx, int(*func)(EVTREC *e, void *user_ptr), void *user_ptr)
 
EVTREC * evt_rec_init (EVTCONTEXT *ctx, int syslog_pri, const char *desc)
 
void evt_rec_add_tag (EVTREC *e, EVTTAG *tag)
 
void evt_rec_add_tagsv (EVTREC *e, va_list tags)
 
void evt_rec_add_tags (EVTREC *e, EVTTAG *first,...)
 
int evt_rec_get_syslog_pri (EVTREC *e)
 
void evt_rec_free (EVTREC *e)
 
EVTTAG * evt_tag_str (const char *tag, const char *value)
 
EVTTAG * evt_tag_mem (const char *tag, const void *value, size_t len)
 
EVTTAG * evt_tag_int (const char *tag, int value)
 
EVTTAG * evt_tag_long (const char *tag, long long value)
 
EVTTAG * evt_tag_errno (const char *tag, int err)
 
EVTTAG * evt_tag_printf (const char *tag, const char *format,...) G_GNUC_PRINTF(2
 
EVTTAG EVTTAG * evt_tag_inaddr (const char *tag, const struct in_addr *addr)
 
EVTTAG * evt_tag_inaddr6 (const char *tag, const struct in6_addr *addr)
 
char * evt_format (EVTREC *e)
 
int evt_log (EVTREC *e)
 
void evt_openlog (const char *ident, int option, int facility)
 
void evt_closelog (void)
 
void evt_vsyslog (int pri, const char *format, va_list ap) G_GNUC_PRINTF(2
 
void void evt_syslog (int pri, const char *format,...) G_GNUC_PRINTF(2
 

Macro Definition Documentation

◆ EVT_FAC_AUTH

#define EVT_FAC_AUTH   (4<<3) /* security/authorization messages */

◆ EVT_FAC_AUTHPRIV

#define EVT_FAC_AUTHPRIV   (10<<3) /* security/authorization messages (private) */

◆ EVT_FAC_CRON

#define EVT_FAC_CRON   (9<<3) /* clock daemon */

◆ EVT_FAC_DAEMON

#define EVT_FAC_DAEMON   (3<<3) /* system daemons */

◆ EVT_FAC_FTP

#define EVT_FAC_FTP   (11<<3) /* ftp daemon */

◆ EVT_FAC_KERN

#define EVT_FAC_KERN   (0<<3) /* kernel messages */

◆ EVT_FAC_LOCAL0

#define EVT_FAC_LOCAL0   (16<<3) /* reserved for local use */

◆ EVT_FAC_LOCAL1

#define EVT_FAC_LOCAL1   (17<<3) /* reserved for local use */

◆ EVT_FAC_LOCAL2

#define EVT_FAC_LOCAL2   (18<<3) /* reserved for local use */

◆ EVT_FAC_LOCAL3

#define EVT_FAC_LOCAL3   (19<<3) /* reserved for local use */

◆ EVT_FAC_LOCAL4

#define EVT_FAC_LOCAL4   (20<<3) /* reserved for local use */

◆ EVT_FAC_LOCAL5

#define EVT_FAC_LOCAL5   (21<<3) /* reserved for local use */

◆ EVT_FAC_LOCAL6

#define EVT_FAC_LOCAL6   (22<<3) /* reserved for local use */

◆ EVT_FAC_LOCAL7

#define EVT_FAC_LOCAL7   (23<<3) /* reserved for local use */

◆ EVT_FAC_LPR

#define EVT_FAC_LPR   (6<<3) /* line printer subsystem */

◆ EVT_FAC_MAIL

#define EVT_FAC_MAIL   (2<<3) /* mail system */

◆ EVT_FAC_NEWS

#define EVT_FAC_NEWS   (7<<3) /* network news subsystem */

◆ EVT_FAC_SYSLOG

#define EVT_FAC_SYSLOG   (5<<3) /* messages generated internally by syslogd */

◆ EVT_FAC_USER

#define EVT_FAC_USER   (1<<3) /* random user-level messages */

◆ EVT_FAC_UUCP

#define EVT_FAC_UUCP   (8<<3) /* UUCP subsystem */

◆ EVT_PRI_ALERT

#define EVT_PRI_ALERT   1 /* action must be taken immediately */

◆ EVT_PRI_CRIT

#define EVT_PRI_CRIT   2 /* critical conditions */

◆ EVT_PRI_DEBUG

#define EVT_PRI_DEBUG   7 /* debug-level messages */

◆ EVT_PRI_EMERG

#define EVT_PRI_EMERG   0 /* system is unusable */

◆ EVT_PRI_ERR

#define EVT_PRI_ERR   3 /* error conditions */

◆ EVT_PRI_INFO

#define EVT_PRI_INFO   6 /* informational */

◆ EVT_PRI_NOTICE

#define EVT_PRI_NOTICE   5 /* normal but significant condition */

◆ EVT_PRI_WARNING

#define EVT_PRI_WARNING   4 /* warning conditions */

Function Documentation

◆ evt_closelog()

void evt_closelog ( void  )

◆ evt_ctx_free()

void evt_ctx_free ( EVTCONTEXT *  ctx)

evt_ctx_free: @ctx: context to free

This function frees an eventlog context.

◆ evt_ctx_init()

EVTCONTEXT* evt_ctx_init ( const char *  prog,
int  syslog_fac 
)

evt_ctx_init: @prog: program name to use to identify this process as @syslog_fac: syslog facility code, like EVT_FAC_AUTH

This function creates a new eventlog context.

Returns: the new context, or NULL on failure

◆ evt_ctx_tag_hook_add()

int evt_ctx_tag_hook_add ( EVTCONTEXT *  ctx,
int(*)(EVTREC *e, void *user_ptr)  func,
void *  user_ptr 
)

evt_ctx_tag_hook_add:

◆ evt_format()

char* evt_format ( EVTREC *  e)

evt_format: : event record

Formats the given event as specified by the current configuration.

Return value: returns a newly allocated string. The caller is responsible for freeing the returned value.

◆ evt_log()

int evt_log ( EVTREC *  e)

evt_log: : event record

Formats and sends the given event as specified by the current configuration. This function blocks and will not return until the message is sent. The function consumes its argument, that is the caller does not need to free the event record after passing it to evt_log().

Return value: 0 to indicate failure and 1 for success

◆ evt_openlog()

void evt_openlog ( const char *  ident,
int  option,
int  facility 
)

◆ evt_rec_add_tag()

void evt_rec_add_tag ( EVTREC *  e,
EVTTAG *  tag 
)

◆ evt_rec_add_tags()

void evt_rec_add_tags ( EVTREC *  e,
EVTTAG *  first,
  ... 
)

◆ evt_rec_add_tagsv()

void evt_rec_add_tagsv ( EVTREC *  e,
va_list  tags 
)

◆ evt_rec_free()

void evt_rec_free ( EVTREC *  e)

◆ evt_rec_get_syslog_pri()

int evt_rec_get_syslog_pri ( EVTREC *  e)

◆ evt_rec_init()

EVTREC* evt_rec_init ( EVTCONTEXT *  ctx,
int  syslog_pri,
const char *  desc 
)

◆ evt_syslog()

void void evt_syslog ( int  pri,
const char *  format,
  ... 
)

◆ evt_tag_errno()

EVTTAG* evt_tag_errno ( const char *  tag,
int  err 
)

◆ evt_tag_inaddr()

EVTTAG EVTTAG* evt_tag_inaddr ( const char *  tag,
const struct in_addr *  addr 
)

◆ evt_tag_inaddr6()

EVTTAG* evt_tag_inaddr6 ( const char *  tag,
const struct in6_addr *  addr 
)

◆ evt_tag_int()

EVTTAG* evt_tag_int ( const char *  tag,
int  value 
)

◆ evt_tag_long()

EVTTAG* evt_tag_long ( const char *  tag,
long long  value 
)

◆ evt_tag_mem()

EVTTAG* evt_tag_mem ( const char *  tag,
const void *  value,
size_t  len 
)

◆ evt_tag_printf()

EVTTAG* evt_tag_printf ( const char *  tag,
const char *  format,
  ... 
)

◆ evt_tag_str()

EVTTAG* evt_tag_str ( const char *  tag,
const char *  value 
)

evt_rec_tag_*: @tag: specifies tag name as string @value: specifies a value in the given type

Adds the specified tag/value pair to EVTREC.

Return value: 0 to indicate failure and 1 for success

◆ evt_vsyslog()

void evt_vsyslog ( int  pri,
const char *  format,
va_list  ap 
)