summaryrefslogtreecommitdiffstats
path: root/ulogd/extensions
diff options
context:
space:
mode:
authorlaforge <laforge>2001-06-14 19:25:25 +0000
committerlaforge <laforge>2001-06-14 19:25:25 +0000
commit71fd5ce504ee00c96ba8033b1c54fa04614a98a6 (patch)
treecd76be0ad990eb3010583991e3da2657488b5ce2 /ulogd/extensions
parent5a94632e3102bdb60db0ce863e0e01a08d02e109 (diff)
Support for logfile cycling (SIGHUP handler)
Diffstat (limited to 'ulogd/extensions')
-rw-r--r--ulogd/extensions/ulogd_LOGEMU.c27
-rw-r--r--ulogd/extensions/ulogd_OPRINT.c34
2 files changed, 50 insertions, 11 deletions
diff --git a/ulogd/extensions/ulogd_LOGEMU.c b/ulogd/extensions/ulogd_LOGEMU.c
index 960084e..35f768d 100644
--- a/ulogd/extensions/ulogd_LOGEMU.c
+++ b/ulogd/extensions/ulogd_LOGEMU.c
@@ -1,4 +1,4 @@
-/* ulogd_LOGEMU.c, Version $Revision: 1.4 $
+/* ulogd_LOGEMU.c, Version $Revision: 1.5 $
*
* ulogd output target for syslog logging emulation
*
@@ -8,7 +8,7 @@
* (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 $
*
*/
@@ -245,9 +245,28 @@ static int get_ids(void)
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 */
diff --git a/ulogd/extensions/ulogd_OPRINT.c b/ulogd/extensions/ulogd_OPRINT.c
index fc00b46..979548d 100644
--- a/ulogd/extensions/ulogd_OPRINT.c
+++ b/ulogd/extensions/ulogd_OPRINT.c
@@ -1,11 +1,11 @@
-/* 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 $
*
*/
@@ -67,9 +67,32 @@ int _output_print(ulog_iret_t *res)
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 },
};
@@ -82,9 +105,6 @@ static void _base_reg_op(void)
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