From 89ae32fe677f0f855ff75e71a6f38c89d554dd65 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 23 Mar 2016 21:30:05 +1000 Subject: [PATCH] * add detection of logfile rotation --- src/jail.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/jail.c b/src/jail.c index f5b20f5..b5583a2 100644 --- a/src/jail.c +++ b/src/jail.c @@ -209,6 +209,14 @@ f2b_jail_process(f2b_jail_t *jail) { f2b_backend_ping(jail->backend); for (file = jail->logfiles; file != NULL; file = file->next) { + if (f2b_logfile_rotated(file)) { + f2b_log_msg(log_info, "jail '%s': file changed -- %s", jail->name, file->path); + f2b_logfile_close(file); + } + if (!file->opened && !f2b_logfile_open(file, NULL)) { + f2b_log_msg(log_error, "jail '%s': can't open file -- %s", jail->name, file->path); + continue; + } while (f2b_logfile_getline(file, logline, sizeof(logline))) { if (!f2b_filter_match(jail->filter, logline, matchbuf, sizeof(matchbuf))) continue;