]> arthur.barton.de Git - ngircd-alex.git/commitdiff
New configuration option "SyslogFacility"
authorAlexander Barton <alex@barton.de>
Fri, 24 Sep 2010 15:39:11 +0000 (17:39 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 24 Sep 2010 15:39:11 +0000 (17:39 +0200)
The new option "SyslogFacility" deines the syslog "facility" to which
ngIRCd should send log messages.

Possible values are system dependant, but most probably "auth", "daemon",
"user" and "local1" through "local7" are possible values; see syslog(3).
Default is "local5" for historical reasons.

ChangeLog
NEWS
doc/sample-ngircd.conf
man/ngircd.conf.5.tmpl
src/ngircd/conf.c
src/ngircd/conf.h
src/ngircd/log.c

index 73c847341cdd323c6d194705129f8e04aaa56200..4402f068572ea1de4453811cfacc5236203f9f6d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
 ngIRCd Release 17
 
+  - New configuration option "SyslogFacility" to define the syslog "facility"
+    (the "target"), to which ngIRCd should send its log messages.
+    Possible values are system dependant, but most probably "auth", "daemon",
+    "user" and "local1" through "local7" are possible values; see syslog(3).
+    Default is "local5" for historical reasons.
   - Dump the "internal server state" (configured servers, established
     connections and known clients) to the console or syslog when receiving
     the SIGUSR2 signal and debug mode is enabled.
diff --git a/NEWS b/NEWS
index d3a600cee5b8f939228ff0d92490daddd400e36d..61e8331e31bdc7d056288d9fc3735a2fbc089d1c 100644 (file)
--- a/NEWS
+++ b/NEWS
 
 ngIRCd Release 17
 
+  - New configuration option "SyslogFacility" to define the syslog "facility"
+    (the "target"), to which ngIRCd should send its log messages.
+    Possible values are system dependant, but most probably "auth", "daemon",
+    "user" and "local1" through "local7" are possible values; see syslog(3).
+    Default is "local5" for historical reasons.
   - Dump the "internal server state" (configured servers, established
     connections and known clients) to the console or syslog when receiving
     the SIGUSR2 signal and debug mode is enabled.
index fdeed355bab93d257a42cfc6007388fbbdb311a4..a2694f8d2aaa7abc6cdfc2b55dba940a14e66dcc 100644 (file)
        # so the server listens on all IP addresses of the system by default.
        ;Listen = 127.0.0.1,192.168.0.1
 
+       # Syslog "facility" to which ngIRCd should send log messages.
+       # Possible values are system dependant, but most probably auth, daemon,
+       # user and local1 through local7 are possible values; see syslog(3).
+       # Default is "local5" for historical reasons, you probably want to
+       # change this to "daemon", for example.
+       SyslogFacility = local1
+
        # Text file with the "message of the day" (MOTD). This message will
        # be shown to all users connecting to the server:
        ;MotdFile = /usr/local/etc/ngircd.motd
index 71aaa1e0e2e89601739a0c109724f6301e9d57e3..f4f7f6e67f4febbc188b2d7aae14403069ad9e86 100644 (file)
@@ -116,6 +116,13 @@ If unset, the defaults value is "0.0.0.0" or, if ngIRCd was compiled
 with IPv6 support, "::,0.0.0.0". So the server listens on all configured
 IP addresses and interfaces by default.
 .TP
+\fBSyslogFacility\fR
+Syslog "facility" to which ngIRCd should send log messages. Possible
+values are system dependant, but most probably "auth", "daemon", "user"
+and "local1" through "local7" are possible values; see syslog(3).
+Default is "local5" for historical reasons, you probably want to
+change this to "daemon", for example.
+.TP
 \fBMotdFile\fR
 Text file with the "message of the day" (MOTD). This message will be shown
 to all users connecting to the server. Changes made to this file
index 5619a6c78e9f6c0840300bb3daba6c67a8ffd404..acb401032f4d2679d6075b49d4868bde3c04fcb2 100644 (file)
@@ -324,6 +324,10 @@ Conf_Test( void )
                printf("  ServerGID = %s\n", grp->gr_name);
        else
                printf("  ServerGID = %ld\n", (long)Conf_GID);
+#ifdef SYSLOG
+       printf("  SyslogFacility = %s\n",
+              ngt_SyslogFacilityName(Conf_SyslogFacility));
+#endif
        printf("  PingTimeout = %d\n", Conf_PingTimeout);
        printf("  PongTimeout = %d\n", Conf_PongTimeout);
        printf("  ConnectRetry = %d\n", Conf_ConnectRetry);
@@ -600,6 +604,14 @@ Set_Defaults(bool InitServers)
        Conf_MaxJoins = 10;
        Conf_MaxNickLength = CLIENT_NICK_LEN_DEFAULT;
 
+#ifdef SYSLOG
+#ifdef LOG_LOCAL5
+       Conf_SyslogFacility = LOG_LOCAL5;
+#else
+       Conf_SyslogFacility = 0;
+#endif
+#endif
+
        /* Initialize server configuration structures */
        if (InitServers) {
                for (i = 0; i < MAX_SERVERS;
@@ -1147,6 +1159,13 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
                Conf_SSLOptions.DHFile = strdup_warn( Arg );
                 return;
         }
+#endif
+#ifdef SYSLOG
+       if (strcasecmp(Var, "SyslogFacility") == 0) {
+               Conf_SyslogFacility = ngt_SyslogFacilityID(Arg,
+                                                          Conf_SyslogFacility);
+               return;
+       }
 #endif
        Config_Error(LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!",
                                                                NGIRCd_ConfFile, Line, Var);
index 5cf5f6b11d9bfcfb19ad5d8925c8cdcc3844a52e..ff67dc79349ac2bb31fc0f54d082904bcac99877 100644 (file)
@@ -173,6 +173,13 @@ GLOBAL int Conf_MaxConnectionsIP;
 /* Maximum length of a nick name */
 GLOBAL unsigned int Conf_MaxNickLength;
 
+#ifdef SYSLOG
+
+/* Syslog "facility" */
+GLOBAL int Conf_SyslogFacility;
+
+#endif
+
 GLOBAL void Conf_Init PARAMS((void));
 GLOBAL bool Conf_Rehash PARAMS((void));
 GLOBAL int Conf_Test PARAMS((void));
index 0cfe3b71f5d605b45b6ba87ce8f2733aff82308c..3710142d81e4d0a57f2a50bf84760ddc3efcd955 100644 (file)
@@ -36,6 +36,7 @@
 #include "conn.h"
 #include "channel.h"
 #include "irc-write.h"
+#include "conf.h"
 
 #include "exp.h"
 #include "log.h"
@@ -72,13 +73,10 @@ Log_Init( bool Daemon_Mode )
        Is_Daemon = Daemon_Mode;
        
 #ifdef SYSLOG
-#ifndef LOG_CONS     /* Kludge: mips-dec-ultrix4.5 has no LOG_CONS/LOG_LOCAL5 */
+#ifndef LOG_CONS     /* Kludge: mips-dec-ultrix4.5 has no LOG_CONS */
 #define LOG_CONS 0
 #endif
-#ifndef LOG_LOCAL5
-#define LOG_LOCAL5 0
-#endif
-       openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
+       openlog(PACKAGE_NAME, LOG_CONS|LOG_PID, Conf_SyslogFacility);
 #endif
 
        Log( LOG_NOTICE, "%s started.", NGIRCd_Version );
@@ -267,7 +265,7 @@ GLOBAL void
 Log_Init_Subprocess(char UNUSED *Name)
 {
 #ifdef SYSLOG
-       openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 );
+       openlog(PACKAGE_NAME, LOG_CONS|LOG_PID, Conf_SyslogFacility);
 #endif
 #ifdef DEBUG
        Log_Subprocess(LOG_DEBUG, "%s sub-process starting, PID %ld.",