diff --git a/exec/mainconfig.c b/exec/mainconfig.c index 3a091a48..8016cf45 100644 --- a/exec/mainconfig.c +++ b/exec/mainconfig.c @@ -167,6 +167,39 @@ int openais_main_config_read ( } } + if (!objdb_get_string (objdb,object_service_handle, "syslog_facility", &value)) { + if (strcmp (value, "daemon") == 0) { + main_config->syslog_facility = LOG_DAEMON; + } else + if (strcmp (value, "local0") == 0) { + main_config->syslog_facility = LOG_LOCAL0; + } else + if (strcmp (value, "local1") == 0) { + main_config->syslog_facility = LOG_LOCAL1; + } else + if (strcmp (value, "local2") == 0) { + main_config->syslog_facility = LOG_LOCAL2; + } else + if (strcmp (value, "local3") == 0) { + main_config->syslog_facility = LOG_LOCAL3; + } else + if (strcmp (value, "local4") == 0) { + main_config->syslog_facility = LOG_LOCAL4; + } else + if (strcmp (value, "local5") == 0) { + main_config->syslog_facility = LOG_LOCAL5; + } else + if (strcmp (value, "local6") == 0) { + main_config->syslog_facility = LOG_LOCAL6; + } else + if (strcmp (value, "local7") == 0) { + main_config->syslog_facility = LOG_LOCAL7; + } else { + error_reason = "unknown syslog facility specified"; + goto parse_error; + } + } + while ( objdb->object_find (object_service_handle, "logger", strlen ("logger"), @@ -258,6 +291,9 @@ int openais_main_config_read ( goto parse_error; } + if (!main_config->syslog_facility) + main_config->syslog_facility = LOG_DAEMON; + return 0; parse_error: diff --git a/exec/mainconfig.h b/exec/mainconfig.h index 83cb477f..22716a98 100644 --- a/exec/mainconfig.h +++ b/exec/mainconfig.h @@ -66,6 +66,7 @@ struct main_config { */ int logmode; char *logfile; + int syslog_facility; /* user/group to run as */ char *user; diff --git a/exec/print.c b/exec/print.c index ca746675..051d4030 100644 --- a/exec/print.c +++ b/exec/print.c @@ -224,6 +224,10 @@ int log_setup (char **error_string, struct main_config *config) } } + if (config->logmode & LOG_MODE_SYSLOG) { + openlog("openais", LOG_CONS|LOG_PID, config->syslog_facility); + } + /* ** reinit all loggers that has initialised before log_setup() was called. */ diff --git a/man/openais.conf.5 b/man/openais.conf.5 index 63b77cd9..60fcf5d5 100644 --- a/man/openais.conf.5 +++ b/man/openais.conf.5 @@ -381,6 +381,14 @@ This specifies that file and line should be printed instead of logger name. The default is off. +.TP +syslog_facility +This specifies the syslog facility type that will be used for any messages +sent to syslog. options are daemon, local0, local1, local2, local3, local4, +local5, local6 & local7. + +The default is daemon. + .PP .PP Within the