- better commented example configuration file
- Makefiles now know DESTDIR (for RPM packaging)
- documentation now built at release-time, not compile time
+- support for logfile-rotating, using new SIGHUP handler
Version 0.95
- libipulog problems of 0.94 fixed
-/* ulogd_LOGEMU.c, Version $Revision: 1.4 $
+/* ulogd_LOGEMU.c, Version $Revision: 1.5 $
*
* ulogd output target for syslog logging emulation
*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
* This software is released under the terms of GNU GPL
*
- * $Id: ulogd_LOGEMU.c,v 1.4 2001/03/25 18:25:01 laforge Exp $
+ * $Id: ulogd_LOGEMU.c,v 1.5 2001/05/20 15:07:45 laforge Exp $
*
*/
return 0;
}
+void sighup_handler_logemu(int signal)
+{
+ switch (signal) {
+ case SIGHUP:
+ ulogd_log(ULOGD_NOTICE, "syslogemu: reopening logfile\n");
+ fclose(of);
+ of = fopen(syslogf_ce.u.string, "a");
+ if (!of) {
+ ulogd_log(ULOGD_FATAL, "can't open syslogemu: %s\n",
+ strerror(errno));
+ exit(2);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
static ulog_output_t logemu_op[] = {
- { NULL, "syslogemu", &_output_logemu },
- { NULL, "", NULL },
+ { NULL, "syslogemu", &_output_logemu, &sighup_handler_logemu },
+ { NULL, "", NULL, NULL },
};
/* register output plugin with ulogd */
-/* ulogd_MAC.c, Version $Revision: 1.5 $
+/* ulogd_MAC.c, Version $Revision: 1.6 $
*
* ulogd output target for logging to a file
*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
* This software is released under the terms of GNU GPL
*
- * $Id: ulogd_OPRINT.c,v 1.5 2000/11/16 17:20:52 laforge Exp $
+ * $Id: ulogd_OPRINT.c,v 1.6 2000/11/20 11:43:22 laforge Exp $
*
*/
return 0;
}
+static config_entry_t outf_ce = { NULL, "dumpfile", CONFIG_TYPE_STRING,
+ CONFIG_OPT_NONE, 0,
+ { string: ULOGD_OPRINT_DEFAULT } };
+
+void sighup_handler_print(int signal)
+{
+
+ switch (signal) {
+ case SIGHUP:
+ ulogd_log(ULOGD_NOTICE, "PKTLOG: reopening logfile\n");
+ fclose(of);
+ of = fopen(outf_ce.u.string, "a");
+ if (!of) {
+ ulogd_log(ULOGD_FATAL, "can't open PKTLOG: %s\n",
+ strerror(errno));
+ exit(2);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
static ulog_output_t base_op[] = {
- { NULL, "oprint", &_output_print },
- { NULL, "", NULL },
+ { NULL, "oprint", &_output_print, &sighup_handler_print },
+ { NULL, "", NULL, NULL },
};
register_output(p);
}
-static config_entry_t outf_ce = { NULL, "dumpfile", CONFIG_TYPE_STRING,
- CONFIG_OPT_NONE, 0,
- { string: ULOGD_OPRINT_DEFAULT } };
void _init(void)
{
#ifdef DEBUG
#ifndef _ULOGD_H
#define _ULOGD_H
-/* ulogd, Version $Revision: 1.12 $
+/* ulogd, Version $Revision: 1.13 $
*
* userspace logging daemon for netfilter ULOG target
* of the linux 2.4 netfilter subsystem.
*
* this code is released under the terms of GNU GPL
*
- * $Id: ulogd.h,v 1.12 2001/02/04 13:07:22 laforge Exp $
+ * $Id: ulogd.h,v 1.13 2001/05/26 23:19:28 laforge Exp $
*/
#include <libipulog/libipulog.h>
char name[ULOGD_MAX_KEYLEN];
/* callback function */
int (*output)(ulog_iret_t *ret);
+ /* callback function for signals (SIGHUP, ..) */
+ int (*signal)(int signal);
} ulog_output_t;
/* entries of the key hash */
-/* ulogd_MYSQL.c, Version $Revision: 1.3 $
+/* ulogd_MYSQL.c, Version $Revision: 1.4 $
*
* ulogd output plugin for logging to a MySQL database
*
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
* This software is distributed under the terms of GNU GPL
*
- * $Id: ulogd_MYSQL.c,v 1.3 2001/05/17 15:06:58 laforge Exp $
+ * $Id: ulogd_MYSQL.c,v 1.4 2001/05/20 13:51:46 laforge Exp $
*
* 15 May 2001, Alex Janssen <alex@ynfonatic.de>:
* Added a compability option for older MySQL-servers, which
return 0;
}
-static ulog_output_t _mysql_plugin = { NULL, "mysql", &_mysql_output };
+static ulog_output_t _mysql_plugin = { NULL, "mysql", &_mysql_output, NULL };
void _init(void)
{
-/* ulogd, Version $Revision: 1.15 $
+/* ulogd, Version $Revision: 1.16 $
+ *
+ * $Id: ulogd.c,v 1.16 2001/05/26 23:19:28 laforge Exp $
*
* userspace logging daemon for the netfilter ULOG target
* of the linux 2.4 netfilter subsystem.
*
* this code is released under the terms of GNU GPL
*
- * $Id: ulogd.c,v 1.15 2001/02/04 10:15:19 laforge Exp $
+ * Modifications:
+ * 14 Jun 2001 Martin Josefsson <gandalf@wlug.westbo.se>
+ * - added SIGHUP handler for logfile cycling
*/
#include <stdio.h>
exit(0);
}
+static void sighup_handler(int signal)
+{
+ ulog_output_t *p;
+
+ ulogd_log(ULOGD_NOTICE, "sighup received, calling plugin handlers\n");
+
+ for (p = ulogd_outputs; p; p = p->next) {
+ if (p->sighup)
+ (*p->sighup)(SIGHUP);
+ }
+}
+
int main(int argc, char* argv[])
{
size_t len;
fclose(stderr);
#endif
signal(SIGTERM, &sigterm_handler);
+ signal(SIGHUP, &sighup_handler);
ulogd_log(ULOGD_NOTICE,
"initialization finished, entering main loop\n");
}
/* hackish, but result is the same */
- sigterm_handler(SIGHUP);
+ sigterm_handler(SIGTERM);
#ifndef DEBUG
} else {