diff --git a/src/jail.c b/src/jail.c index 0f7ff26..e2477bd 100644 --- a/src/jail.c +++ b/src/jail.c @@ -110,7 +110,7 @@ f2b_jail_ban(f2b_jail_t *jail, f2b_ipaddr_t *addr) { } if (f2b_backend_ban(jail->backend, addr->text)) { - f2b_log_msg(log_info, "jail '%s': banned ip %s", jail->name, addr->text); + f2b_log_msg(log_note, "jail '%s': banned ip %s", jail->name, addr->text); return true; } @@ -128,7 +128,7 @@ f2b_jail_unban(f2b_jail_t *jail, f2b_ipaddr_t *addr) { addr->bantime = 0; if (f2b_backend_unban(jail->backend, addr->text)) { - f2b_log_msg(log_info, "jail '%s': released ip %s", jail->name, addr->text); + f2b_log_msg(log_note, "jail '%s': released ip %s", jail->name, addr->text); return true; } @@ -184,7 +184,7 @@ f2b_jail_process(f2b_jail_t *jail) { addr->lastseen = now; f2b_matches_append(&addr->matches, now); jail->ipaddrs = f2b_addrlist_append(jail->ipaddrs, addr); - f2b_log_msg(log_debug, "jail '%s': new ip found -- %s", jail->name, matchbuf); + f2b_log_msg(log_info, "jail '%s': new ip found -- %s", jail->name, matchbuf); continue; } /* this ip was seen before */ @@ -196,7 +196,7 @@ f2b_jail_process(f2b_jail_t *jail) { f2b_matches_expire(&addr->matches, now - jail->findtime); f2b_matches_append(&addr->matches, now); if (addr->matches.used < jail->maxretry) { - f2b_log_msg(log_debug, "jail '%s': new match %s (%d/%d)", jail->name, matchbuf, addr->matches.used, addr->matches.max); + f2b_log_msg(log_info, "jail '%s': new match %s (%d/%d)", jail->name, matchbuf, addr->matches.used, addr->matches.max); continue; } /* limit reached, ban ip */ diff --git a/src/log.c b/src/log.c index 09dc0c6..721f908 100644 --- a/src/log.c +++ b/src/log.c @@ -10,6 +10,7 @@ static FILE *logfile = NULL; static const char *loglevels[] = { "debug", "info", + "notice", "warn", "error", "fatal", @@ -20,6 +21,7 @@ get_facility(log_msgtype_t l) { switch (l) { case log_debug: return LOG_DEBUG; case log_info: return LOG_INFO; + case log_note: return LOG_NOTICE; case log_warn: return LOG_WARNING; case log_error: return LOG_ERR; case log_fatal: return LOG_CRIT; @@ -57,6 +59,7 @@ void f2b_log_msg(log_msgtype_t l, const char *fmt, ...) { void f2b_log_set_level(const char *level) { if (strcmp(level, "debug") == 0) { minlevel = log_debug; return; } if (strcmp(level, "info") == 0) { minlevel = log_info; return; } + if (strcmp(level, "notice")== 0) { minlevel = log_note; return; } if (strcmp(level, "warn") == 0) { minlevel = log_warn; return; } if (strcmp(level, "error") == 0) { minlevel = log_error; return; } if (strcmp(level, "fatal") == 0) { minlevel = log_fatal; return; } diff --git a/src/log.h b/src/log.h index ad212cf..0316c3f 100644 --- a/src/log.h +++ b/src/log.h @@ -6,9 +6,10 @@ typedef enum { log_debug = 0, log_info = 1, - log_warn = 2, - log_error = 3, - log_fatal = 4 + log_note = 2, + log_warn = 3, + log_error = 4, + log_fatal = 5 } log_msgtype_t; void f2b_log_msg(log_msgtype_t l, const char *fmt, ...); diff --git a/src/main.c b/src/main.c index aff96d7..1821bec 100644 --- a/src/main.c +++ b/src/main.c @@ -35,7 +35,7 @@ void sa_term(int signum) { } void sa_hup(int signum) { UNUSED(signum); - f2b_log_msg(log_info, "got SIGHUP, reloading config"); + f2b_log_msg(log_note, "got SIGHUP, reloading config"); rcfg = true; } @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) { f2b_config_free(&config); if (!jails) { - f2b_log_msg(log_error, "no jails configured, exiting"); + f2b_log_msg(log_warn, "no jails configured, exiting"); return EXIT_FAILURE; }