From: Martin Mares Date: Fri, 11 Aug 2017 16:35:45 +0000 (+0200) Subject: Daemon: Configurable logging X-Git-Tag: v0.9~25 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=4edbdb9df9140ba4df3564064ebc332c100fcb21;p=subauth.git Daemon: Configurable logging --- diff --git a/etc/subauthd b/etc/subauthd index 4e42a47..b66b178 100644 --- a/etc/subauthd +++ b/etc/subauthd @@ -13,6 +13,11 @@ SubauthD { # Maximum number of simultaneous client connections MaxConnections 1000 +#ifndef CONFIG_LOCAL + # Log to a given stream (configured below) + LogStream syslog +#endif + # Authentication zones: each zone contains accounts for local users # (at most one per user), zones are completely independent. Zone { @@ -38,3 +43,16 @@ SubauthD { MaxTempValidity 3600 } } +#ifndef CONFIG_LOCAL + +# Logging rules (see LibUCW documentation for full explanation) + +Logging { + Stream { + Name syslog + SyslogFacility auth + SyslogPID 0 + Levels:remove debug + } +} +#endif diff --git a/server/subauthd.c b/server/subauthd.c index 393c834..df6d5e8 100644 --- a/server/subauthd.c +++ b/server/subauthd.c @@ -27,6 +27,7 @@ static uint max_connections = ~0U; clist zone_list; char *database_name = "subauthd.db"; char *temp_key_file; +char *log_stream_name; static struct main_file listen_socket; static uint num_connections; @@ -312,6 +313,7 @@ static struct cf_section daemon_config = { CF_LIST("Zone", &zone_list, &zone_config), CF_STRING("Database", &database_name), CF_STRING("TempKeyFile", &temp_key_file), + CF_STRING("LogStream", &log_stream_name), CF_END } }; @@ -336,6 +338,9 @@ int main(int argc UNUSED, char **argv) cf_declare_section("SubauthD", &daemon_config, 0); opt_parse(&options, argv+1); + if (log_stream_name) + log_configured(log_stream_name); + auth_init(); temp_init(); main_init();