diff --git a/src/Reporter.cc b/src/Reporter.cc index 145bce4aea..a652ba50d6 100644 --- a/src/Reporter.cc +++ b/src/Reporter.cc @@ -59,7 +59,7 @@ Reporter::Reporter(bool arg_abort_on_scripting_errors) weird_sampling_duration = 0; weird_sampling_threshold = 0; - openlog("bro", 0, LOG_LOCAL5); + syslog_open = false; } Reporter::~Reporter() @@ -265,6 +265,12 @@ void Reporter::Syslog(const char* fmt, ...) if ( run_state::reading_traces ) return; + if ( ! syslog_open ) + { + openlog("bro", 0, LOG_LOCAL5); + syslog_open = true; + } + va_list ap; va_start(ap, fmt); vsyslog(LOG_NOTICE, fmt, ap); diff --git a/src/Reporter.h b/src/Reporter.h index be5515ee11..12ed830f00 100644 --- a/src/Reporter.h +++ b/src/Reporter.h @@ -325,6 +325,7 @@ private: int errors; bool via_events; + bool syslog_open; int in_error_handler; bool info_to_stderr; bool warnings_to_stderr;