20
20
* Inspired by nsyslog, originally written by Darren Reed.
22
* $Id: afuser.c,v 1.8 2001/05/04 12:37:43 bazsi Exp $
22
* $Id: afuser.c,v 1.9 2003/01/31 14:26:48 bazsi Exp $
24
24
***************************************************************************/
38
38
#include "afuser.c.x"
43
44
(super log_dest_driver)
47
(template_output string)
48
(template_escape . int)
49
(cfg object syslog_config)))
53
afuser_dest_set_template(struct log_dest_driver *c, char *t)
55
CAST(afuser_dest, self, c);
57
self->template_output = c_format("%z", t);
61
afuser_dest_set_template_escape(struct log_dest_driver *c, int enable)
63
CAST(afuser_dest, self, c);
65
self->template_escape = enable;
49
69
do_init_afuser_dest(struct log_handler *c,
50
70
struct syslog_config *cfg,
51
71
struct persistent_config *persistent)
73
CAST(afuser_dest, self, c);
53
77
return ST_OK | ST_GOON;
56
static void do_handle_afuser_log(struct log_handler *c, struct log_info *msg)
81
do_handle_afuser_log(struct log_handler *c, struct log_info *msg)
58
83
CAST(afuser_dest, self, c);
60
85
struct ol_string *msg_line;
62
msg_line = c_format("%S %S %S\n", msg->date, msg->host, msg->msg);
87
if (self->template_output) {
88
msg_line = c_format("%fS",
91
self->template_output,
92
self->template_escape, msg));
94
msg_line = c_format("%S %S %S\n",
95
msg->date, msg->host, msg->msg);
63
98
while ((ut = getutent())) {
64
99
#if HAVE_MODERN_UTMP
65
100
if (ut->ut_type == USER_PROCESS &&