]> mj.ucw.cz Git - subauth.git/commitdiff
Daemon: Configurable logging
authorMartin Mares <mj@ucw.cz>
Fri, 11 Aug 2017 16:35:45 +0000 (18:35 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 11 Aug 2017 16:35:45 +0000 (18:35 +0200)
etc/subauthd
server/subauthd.c

index 4e42a470ef5d5a34ee2273816e43ebe13f01e917..b66b17827bdcf2f5dc21602ce0af4d913f8449f8 100644 (file)
@@ -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
index 393c8342031b91a9aaa4a06e67bf7c1bab04a8c9..df6d5e8ebf64005e6dc1b33c1d1874c17e9289cf 100644 (file)
@@ -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();