From 161eb2989611f209f40332e1ad3303ec051d18ab Mon Sep 17 00:00:00 2001 From: laforge Date: Sun, 20 May 2001 15:07:45 +0000 Subject: added support for synchronous writes to ulogd_LOGEMU (Michael Stolovitzsky) --- Changes | 1 + doc/ulogd.sgml | 37 +++++++++++++++++++++++++++---------- extensions/ulogd_LOGEMU.c | 27 ++++++++++++++++++++------- 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/Changes b/Changes index 41bb41d..a5d72fb 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,7 @@ Version 0.96 - autoconf now includes /usr/src/linux/include, because most distros now have a glibc-provided /usr/include/linux :( - removed ./configure from CVS tree as it may cause inconsistencies +- added support for synchronous write to LOGEMU (Michael Stolovitzsky) Version 0.95 - libipulog problems of 0.94 fixed diff --git a/doc/ulogd.sgml b/doc/ulogd.sgml index 7202f45..750249c 100644 --- a/doc/ulogd.sgml +++ b/doc/ulogd.sgml @@ -1,12 +1,12 @@ - +
ULOGD - the Userspace Logging Daemon Harald Welte <laforge@gnumonks.org> -Revision $Revision: 1.3 $, $Date: 2001/01/29 11:45:22 $ +Revision $Revision: 1.4 $, $Date: 2001/05/20 13:50:05 $ This is the documentation for ulogd, the Userspace logging daemon. @@ -178,16 +178,29 @@ The module defines the following configuration directives: syslogfileThe filename where it should log to. The default is /var/log/ulogd.syslogemu + +syslogsyncSet this to 1 if you want to have your logfile written synchronously. This may reduce performance, but makes your log-lines appear immediately. The default is 0 + ulogd_MYSQL.so -An output plugin for logging into a mysql database. This is only compiled if you have the mysql libraries installed, and the configure script was able to detect them. (FIXME: how to do this) -

-The plugin automagically inserts the data into the configured table; It connects to mysql during the startup phase of ulogd and obtains a list of the columns in the table. Then it tries to resolve the column names against keys of interpreter plugins. This way you can easly select which information you want to log - just by the layout of the table. -

-If, for example, your table contains a field called 'ip_saddr', ulogd will resolve this against the key 'ip.saddr' and put the ip address as 32bit unsigned integer into the table. -

-You may want to have a look at the file 'doc/mysql.table' as an example table including fields to log all keys from ulogd_BASE.so. Just delete the fields you are not interested in, and create the table. -

+An output plugin for logging into a mysql database. This is only compiled if +you have the mysql libraries installed, and the configure script was able to +detect them. (that is: --with-mysql was specified for ./configure)

+ +The plugin automagically inserts the data into the configured table; It +connects to mysql during the startup phase of ulogd and obtains a list of the +columns in the table. Then it tries to resolve the column names against keys of +interpreter plugins. This way you can easly select which information you want +to log - just by the layout of the table.

+ +If, for example, your table contains a field called 'ip_saddr', ulogd will +resolve this against the key 'ip.saddr' and put the ip address as 32bit +unsigned integer into the table.

+ +You may want to have a look at the file 'doc/mysql.table' as an +example table including fields to log all keys from ulogd_BASE.so. Just delete +the fields you are not interested in, and create the table.

+ The module defines the following configuration directives: mysqltable @@ -208,5 +221,9 @@ Password for mysql All comments / questions / ... are appreciated.

Just drop me a note to laforge@gnumonks.org +

+Please note also that there is now a mailinglist, ulogd@lists.gnumonks.org. +You can subscribe at +

diff --git a/extensions/ulogd_LOGEMU.c b/extensions/ulogd_LOGEMU.c index c9b1ac5..960084e 100644 --- a/extensions/ulogd_LOGEMU.c +++ b/extensions/ulogd_LOGEMU.c @@ -1,4 +1,4 @@ -/* ulogd_LOGEMU.c, Version $Revision: 1.3 $ +/* ulogd_LOGEMU.c, Version $Revision: 1.4 $ * * ulogd output target for syslog logging emulation * @@ -8,7 +8,7 @@ * (C) 2000 by Harald Welte * This software is released under the terms of GNU GPL * - * $Id: ulogd_LOGEMU.c,v 1.3 2001/02/04 13:39:31 laforge Exp $ + * $Id: ulogd_LOGEMU.c,v 1.4 2001/03/25 18:25:01 laforge Exp $ * */ @@ -27,12 +27,25 @@ #define ULOGD_LOGEMU_DEFAULT "/var/log/ulogd.syslogemu" #endif +#ifndef ULOGD_LOGEMU_SYNC_DEFAULT +#define ULOGD_LOGEMU_SYNC_DEFAULT 0 +#endif + #define NIPQUAD(addr) \ ((unsigned char *)&addr)[0], \ ((unsigned char *)&addr)[1], \ ((unsigned char *)&addr)[2], \ ((unsigned char *)&addr)[3] +static config_entry_t syslogf_ce = { NULL, "syslogfile", CONFIG_TYPE_STRING, + CONFIG_OPT_NONE, 0, + { string: ULOGD_LOGEMU_DEFAULT } }; + +static config_entry_t syslsync_ce = { &syslogf_ce, "syslogsync", + CONFIG_TYPE_INT, CONFIG_OPT_NONE, 0, + { value: ULOGD_LOGEMU_SYNC_DEFAULT } + }; + static FILE *of = NULL; static char hostname[255]; @@ -206,6 +219,10 @@ int _output_logemu(ulog_iret_t *res) break; } fprintf(of,"\n"); + + if (syslsync_ce.u.value) + fflush(of); + return 0; } @@ -243,14 +260,10 @@ static void _logemu_reg_op(void) register_output(p); } -static config_entry_t syslogf_ce = { NULL, "syslogfile", CONFIG_TYPE_STRING, - CONFIG_OPT_NONE, 0, - { string: ULOGD_LOGEMU_DEFAULT } }; - void _init(void) { /* FIXME: error handling */ - config_register_key(&syslogf_ce); + config_register_key(&syslsync_ce); config_parse_file(0); if (gethostname(hostname, sizeof(hostname)) < 0) { -- cgit v1.2.3